This commit is contained in:
Arron David Nelson 2023-12-05 16:02:42 -08:00
parent 35948fce3e
commit b21bc3d44d
12 changed files with 191 additions and 62 deletions

2
.idea/TechDemo.iml generated Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

87
.idea/editor.xml generated Normal file
View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BackendCodeEditorSettings">
<option name="/Default/Housekeeping/GlobalSettingsUpgraded/IsUpgraded/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="NEXT_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="NEXT_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="NEXT_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="LINE_BREAK" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="NEXT_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/FREE_BLOCK_BRACES/@EntryValue" value="NEXT_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="NEXT_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="NEXT_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="NEXT_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Tab" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="ClangTidy" enabled="true" level="WARNING" enabled_by_default="true">
<option name="clangTidyChecks" value="-*,bugprone-argument-comment,bugprone-assert-side-effect,bugprone-bad-signal-to-kill-thread,bugprone-branch-clone,bugprone-copy-constructor-init,bugprone-dangling-handle,bugprone-dynamic-static-initializers,bugprone-fold-init-type,bugprone-forward-declaration-namespace,bugprone-forwarding-reference-overload,bugprone-inaccurate-erase,bugprone-incorrect-roundings,bugprone-integer-division,bugprone-lambda-function-name,bugprone-macro-parentheses,bugprone-macro-repeated-side-effects,bugprone-misplaced-operator-in-strlen-in-alloc,bugprone-misplaced-pointer-arithmetic-in-alloc,bugprone-misplaced-widening-cast,bugprone-move-forwarding-reference,bugprone-multiple-statement-macro,bugprone-no-escape,bugprone-parent-virtual-call,bugprone-posix-return,bugprone-reserved-identifier,bugprone-sizeof-container,bugprone-sizeof-expression,bugprone-spuriously-wake-up-functions,bugprone-string-constructor,bugprone-string-integer-assignment,bugprone-string-literal-with-embedded-nul,bugprone-suspicious-enum-usage,bugprone-suspicious-include,bugprone-suspicious-memset-usage,bugprone-suspicious-missing-comma,bugprone-suspicious-semicolon,bugprone-suspicious-string-compare,bugprone-suspicious-memory-comparison,bugprone-suspicious-realloc-usage,bugprone-swapped-arguments,bugprone-terminating-continue,bugprone-throw-keyword-missing,bugprone-too-small-loop-variable,bugprone-undefined-memory-manipulation,bugprone-undelegated-constructor,bugprone-unhandled-self-assignment,bugprone-unused-raii,bugprone-unused-return-value,bugprone-use-after-move,bugprone-virtual-near-miss,cert-dcl21-cpp,cert-dcl58-cpp,cert-err34-c,cert-err52-cpp,cert-err60-cpp,cert-flp30-c,cert-msc50-cpp,cert-msc51-cpp,cert-str34-c,cppcoreguidelines-interfaces-global-init,cppcoreguidelines-narrowing-conversions,cppcoreguidelines-pro-type-member-init,cppcoreguidelines-pro-type-static-cast-downcast,cppcoreguidelines-slicing,google-default-arguments,google-explicit-constructor,google-runtime-operator,hicpp-exception-baseclass,hicpp-multiway-paths-covered,misc-misplaced-const,misc-new-delete-overloads,misc-no-recursion,misc-non-copyable-objects,misc-throw-by-value-catch-by-reference,misc-unconventional-assign-operator,misc-uniqueptr-reset-release,modernize-avoid-bind,modernize-concat-nested-namespaces,modernize-deprecated-headers,modernize-deprecated-ios-base-aliases,modernize-loop-convert,modernize-make-shared,modernize-make-unique,modernize-pass-by-value,modernize-raw-string-literal,modernize-redundant-void-arg,modernize-replace-auto-ptr,modernize-replace-disallow-copy-and-assign-macro,modernize-replace-random-shuffle,modernize-return-braced-init-list,modernize-shrink-to-fit,modernize-unary-static-assert,modernize-use-bool-literals,modernize-use-emplace,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nodiscard,modernize-use-noexcept,modernize-use-nullptr,modernize-use-override,modernize-use-transparent-functors,modernize-use-uncaught-exceptions,mpi-buffer-deref,mpi-type-mismatch,openmp-use-default-none,performance-faster-string-find,performance-for-range-copy,performance-implicit-conversion-in-loop,performance-inefficient-algorithm,performance-inefficient-string-concatenation,performance-inefficient-vector-operation,performance-move-const-arg,performance-move-constructor-init,performance-no-automatic-move,performance-noexcept-move-constructor,performance-trivially-destructible,performance-type-promotion-in-math-fn,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,portability-simd-intrinsics,readability-avoid-const-params-in-decls,readability-const-return-type,readability-container-size-empty,readability-convert-member-functions-to-static,readability-delete-null-pointer,readability-deleted-default,readability-inconsistent-declaration-parameter-name,readability-make-member-function-const,readability-misleading-indentation,readability-misplaced-array-index,readability-non-const-parameter,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-smartptr-get,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-subscript-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,readability-string-compare,readability-uniqueptr-delete-release,readability-use-anyofallof" />
</inspection_tool>
</profile>
</component>

1
.idea/misc.xml generated
View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/TechDemo.iml" filepath="$PROJECT_DIR$/.idea/TechDemo.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -41,4 +41,4 @@ target_include_directories(TechDemo PRIVATE "${USER_HOME_DIRECTORY}/Libraries/LW
find_package(Vulkan REQUIRED)
target_link_libraries(TechDemo PRIVATE Vulkan::Headers Vulkan::Vulkan xcb xcb-xfixes xcb-xinput wooting_analog_wrapper LWE z asound)
target_link_libraries(TechDemo PRIVATE Vulkan::Headers Vulkan::Vulkan xcb xcb-cursor xcb-xfixes xcb-xinput wooting_analog_wrapper LWE z asound)

View File

@ -44,17 +44,9 @@ void MainMenu::PostInitialize(lwe::GpuCmdBuffer* cmdBuffer)
Level::PostInitialize(cmdBuffer);
}
void MainMenu::OnUpdate(lwe::Input* input, const float delta)
void MainMenu::OnUpdate(lwe::RenderWindow* win, lwe::Input* input, const float delta)
{
Level::OnUpdate(input, delta);
lwe::GameLoop* gl = (lwe::GameLoop*)GetParent("GameLoop");
if (!gl)
return;
lwe::RenderWindow* win = gl->GetWindow();
if (!win)
return;
Level::OnUpdate(win, input, delta);
lwe::Vec2_f client = win->GetScale();

View File

@ -22,5 +22,5 @@ public:
void PostInitialize(lwe::GpuCmdBuffer* cmdBuffer) override;
void OnUpdate(lwe::Input* input, const float delta) override;
void OnUpdate(lwe::RenderWindow* win, lwe::Input* input, const float delta) override;
};

View File

@ -23,7 +23,6 @@
#include <LWE/Systems/SolidColorSystem.h>
#include <LWE/Systems/NetSystem.h>
#include <LWE/Systems/PhongSystem.h>
#include <LWE/Systems/DynamicsSystem.h>
#include <LWE/Components/Camera.h>
#include <LWE/Components/PlyController.h>
#include <LWE/Components/Skybox.h>
@ -39,17 +38,18 @@
#include <LWE/Components/Projectile.h>
#include <LWE/Components/Health.h>
#include <LWE/Components/Networked.h>
#include <LWE/Components/Dynamics.h>
#include <LWE/Gui/LabelGui.h>
#include <LWE/Gui/SolidBoxGui.h>
#include <LWE/Gui/ButtonGui.h>
#include <LWE/Gui/CheckBoxGui.h>
#include <LWE/Gui/TextFieldGui.h>
#include <LWE/Gui/ImgGui.h>
#include <LWE/Gui/PanelGui.h>
#include <LWE/Gui/CollectionGui.h>
#include <LWE/Systems/BillboardSystem.h>
#include <LWE/Components/Billboard.h>
#include <LWE/IO/HID/Keyboard.h>
#include <LWE/IO/HID/Mouse.h>
#include <LWE/IO/HID/GenericInputHandler.h>
TestLevel::TestLevel()
: count(0), cooldown(0.0f)
@ -214,10 +214,10 @@ void TestLevel::Setup()
}
*/
AddSystem(new lwe::DynamicsSystem());
AddSystem(new lwe::RigidBodySystem());
AddSystem(new lwe::CameraSystem());
//AddSystem(new lwe::AudioSystem());
AddSystem(new lwe::SkyboxSystem());
AddSystem(new lwe::RigidBodySystem(true));
AddSystem(new lwe::CameraSystem());
AddSystem(new lwe::PhongSystem());
AddSystem(new lwe::SolidColorSystem());
AddSystem(new lwe::BillboardSystem());
@ -226,8 +226,6 @@ void TestLevel::Setup()
ls->SetAmbient({0.25f, 0.25f, 0.25f});
AddSystem(ls);
//AddSystem(new lwe::AudioSystem());
lwe::TimerSystem* timerSys = new lwe::TimerSystem();
AddSystem(timerSys);
@ -288,15 +286,15 @@ void TestLevel::Setup()
gbg->SetText("Garbage: " + lwe::Str_8::FromNum(lwe::GarbageCollector::Size()));
}});
lwe::ButtonGui* testBttn = new lwe::ButtonGui("Test", "Test");
testBttn->SetScale({200.0f, 50.0f});
testBttn->SetPosition({400.0f, 400.0f});
guiSys->AddGui(testBttn);
lwe::PanelGui* testPanel = new lwe::PanelGui("TestPanel");
testPanel->SetPosition({300.0f, 200.0f});
testPanel->SetScale({400.0f, 400.0f});
guiSys->AddGui(testPanel);
lwe::Entity* player = new lwe::Entity("Player");
//player->AddComponent(new lwe::Networked(true, false, lwe::EndpointOwner::ENDPOINT));
player->AddComponent(new lwe::Point3D("Head"));
player->AddComponent(new lwe::Point3D("Head", 1.0f, 1.0f));
player->AddComponent(new lwe::PlyController("Head"));
//player->AddComponent(new lwe::Health(100, 100));
@ -309,7 +307,7 @@ void TestLevel::Setup()
AddTemplate(player);
lwe::Entity* plyPuppet = new lwe::Entity("Puppet");
plyPuppet->AddComponent(new lwe::OBB3D("Head"));
plyPuppet->AddComponent(new lwe::OBB3D("Head", 1.0f, 1.0f));
plyPuppet->AddComponent(new lwe::Camera("Head"));
plyPuppet->AddComponent(new lwe::Health(100, 100));
@ -344,8 +342,25 @@ void TestLevel::Setup()
//as->EnableAttenuation(false);
ent->AddComponent(as);
lwe::Sphere* sphere = new lwe::Sphere("Sphere", 5.0f);
ent->AddComponent(sphere);
lwe::Health* entHealth = new lwe::Health(100, 100);
ent->AddComponent(entHealth);
lwe::OBB3D* entCollider = new lwe::OBB3D("Collider", 1.0f, 1.0f);
entCollider->SetScale({1.0f, 2.0f, 1.0f});
entCollider->SetPos({0.0f, 1.1f, 0.0f});
entCollider->SetCollidedCb([](lwe::RigidBody* a, lwe::RigidBody* b)
{
lwe::Entity* aOwner = (lwe::Entity*)a->GetParent();
lwe::Health* health = (lwe::Health*)aOwner->GetComponent("Health");
health->TakeDamage(10);
lwe::Entity* bOwner = (lwe::Entity*)b->GetParent();
bOwner->Delete();
if (health->GetHealth() <= 0)
aOwner->Delete();
});
ent->AddComponent(entCollider);
/*
lwe::AudioSource* as2 = new lwe::AudioSource("Song2", "sample");
@ -388,8 +403,10 @@ void TestLevel::Setup()
bullet->SetScale({0.1f, 0.1f, 0.1f});
bullet->AddComponent(new lwe::Projectile(25));
bullet->AddComponent(new lwe::Dynamics(50.0f));
bullet->AddComponent(new lwe::Point3D("Tip"));
lwe::OBB3D* bulletCollider = new lwe::OBB3D("Collider", 1.0f, 1.0f);
bulletCollider->SetScale(0.1f);
bullet->AddComponent(bulletCollider);
lwe::SolidColor* bulletMdl = new lwe::SolidColor("Mdl", {1.0f, 1.0f, 0.0f, 1.0f}, "Cube", "");
bullet->AddComponent(bulletMdl);
@ -437,23 +454,32 @@ void TestLevel::PostInitialize(lwe::GpuCmdBuffer* cmdBuffer)
*/
}
void TestLevel::OnUpdate(lwe::Input* input, const float delta)
void TestLevel::OnUpdate(lwe::RenderWindow* win, lwe::Input* input, const float delta)
{
lwe::GameLoop* gl = (lwe::GameLoop*)GetParent("GameLoop");
if (!gl)
return;
lwe::GenericInputHandler* handler = (lwe::GenericInputHandler*)input->GetHandler("GenericInputHandler");
if (!handler)
const lwe::InputHandler* ih = win->GetInputHandler();
if (!ih)
return;
const lwe::Mouse* mouse = handler->GetPrimaryMouse();
const lwe::Keyboard* keyboard = handler->GetPrimaryKeyboard();
const lwe::Mouse* mouse = (lwe::Mouse*)ih->GetDeviceByType(LWE_HID_MOUSE);
if (!mouse)
return;
const lwe::Keyboard* keyboard = (lwe::Keyboard*)ih->GetDeviceByType(LWE_HID_KEYBOARD);
if (!keyboard)
return;
lwe::Entity* ent = GetEntity("Main");
if (!ent)
return;
ent->SetRot(ent->GetRot() + lwe::Vec3_f(50.0f) * delta);
lwe::Entity* ply = GetEntity("Player");
if (ply)
if (ply && win->IsCursorConstrained() && !win->IsCursorVisible())
{
lwe::PlyController* cam = (lwe::PlyController*)ply->GetComponent("PlyController", "Head");
if (cam)
@ -473,8 +499,8 @@ void TestLevel::OnUpdate(lwe::Input* input, const float delta)
bullet->SetScale({0.1f, 0.1f, 0.1f});
bullet->SetRot(ply->GetRot());
lwe::Dynamics* dynamics = (lwe::Dynamics*)bullet->GetComponent("Dynamics");
dynamics->SetVelocity(cam->GetTransform().GetForward() * 100.0f);
lwe::OBB3D* rb = (lwe::OBB3D*)bullet->GetComponent("OBB3D", "Collider");
rb->SetVelocity(cam->GetTransform().GetForward() * 10.0f);
cooldown = 0.15f;
}
@ -516,6 +542,8 @@ void TestLevel::OnUpdate(lwe::Input* input, const float delta)
playback->SetText("Playback: " + lwe::Str_8::FromNum(elapsed / 60) + ":" + lwe::Str_8::FromNum(elapsed % 60) +
" / " + lwe::Str_8::FromNum(duration / 60) + ":" + lwe::Str_8::FromNum(duration % 60));
if (win->IsCursorConstrained() && !win->IsCursorVisible())
{
if (keyboard->IsJustReleased(lwe::Keyboard::Left))
source->SetVolume(source->GetVolume() - 0.25f);
@ -535,4 +563,5 @@ void TestLevel::OnUpdate(lwe::Input* input, const float delta)
if (keyboard->IsJustReleased(lwe::Keyboard::Backspace))
source->Reset();
}
}

View File

@ -27,5 +27,5 @@ public:
void PostInitialize(lwe::GpuCmdBuffer* cmdBuffer) override;
void OnUpdate(lwe::Input* input, const float delta) override;
void OnUpdate(lwe::RenderWindow* win, lwe::Input* input, const float delta) override;
};

View File

@ -13,7 +13,6 @@
#include <LWE/IO/RenderWindow.h>
#include <LWE/GameLoop.h>
#include <LWE/IO/HID/Wooting.h>
#include <LWE/IO/HID/GenericInputHandler.h>
#include <vulkan/vulkan.h>
@ -118,14 +117,14 @@ lwe::SInt_32 Main(lwe::Str_8* appName, lwe::Str_8* appVerId, lwe::Version* appVe
configFile.Release();
lwe::Array<lwe::Str_8> args = lwe::Console::GetArgs_8();
lwe::Vector<lwe::Str_8> args = lwe::Console::GetArgs_8();
if (args.Size() > 1 && lwe::Str_8::Cmp(args[1], "-server"))
{
lwe::Console::Attach();
lwe::Console::SetTitle_8("TechDemo");
LWE_LOG("Info", "TechDemo", 0, "Initializing server, standby.");
LWE_LOG("Info", 0, "Initializing server, standby.");
lwe::GameLoop gl((lwe::UInt_8)*(lwe::JsonNum*)config.RetrieveValue("engine.threadCount"), 0);
gl.EnableTimeLock(*(lwe::JsonBool*)config.RetrieveValue("engine.timeLocked"));
@ -179,9 +178,6 @@ lwe::SInt_32 Main(lwe::Str_8* appName, lwe::Str_8* appVerId, lwe::Version* appVe
gl.EnableTimeLock(*(lwe::JsonBool*)config.RetrieveValue("engine.timeLocked"));
gl.SetMaxTPS((lwe::UInt_32)*(lwe::JsonNum*)config.RetrieveValue("engine.maxTPS"));
lwe::Input* input = gl.GetInput();
input->AddHandler(new lwe::GenericInputHandler());
lwe::Frame mainFrame("Main");
gl.AddFrame(&mainFrame);
mainFrame.AddLevel(new TestLevel("Test"));