diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-01-14 18:17:54 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-01-14 18:17:54 -0500 |
| commit | 5a7b4a65a1d93744e4a5e6cc6df4244f61b81f68 (patch) | |
| tree | 4b59cb1d6e513c1caefdc7e4c35955741bcfe206 /src/player-input.cpp | |
| parent | 80a67230fe192287503092a3d256aea3a494409c (diff) | |
chore: fix compiler warnings + extra includes
Diffstat (limited to 'src/player-input.cpp')
| -rw-r--r-- | src/player-input.cpp | 74 |
1 files changed, 36 insertions, 38 deletions
diff --git a/src/player-input.cpp b/src/player-input.cpp index 84f5898..a75daa3 100644 --- a/src/player-input.cpp +++ b/src/player-input.cpp @@ -2,11 +2,9 @@ #include "player-input.hpp" #include "dynamic-array.hpp" -#include "game-settings.hpp" #include "window.hpp" #include <GLFW/glfw3.h> -#include <chrono> struct CursorEnterEvent { bool entered; @@ -68,8 +66,7 @@ DynArray<PkeInputSet> registeredInputSets{0, nullptr}; DynArray<InputActionSetHandle> activeInputSetStack{0, nullptr}; PkeInputAction *FindActionByName(const char *actionName) { - int64_t count = 0; - count = activeInputSetStack.Count(); + int64_t count = activeInputSetStack.Count(); for (int64_t i = count - 1; i >= 0; --i) { InputActionSetHandle handle = activeInputSetStack[i]; InputActionSetHandle_T index = static_cast<InputActionSetHandle_T>(handle); @@ -260,15 +257,16 @@ constexpr auto FindActivePkeInputAction_MouseButton_ByType = FindActivePkeInputA constexpr auto FindActivePkeInputAction_Scroll_ByType = FindActivePkeInputAction_ByType<PKE_INPUT_HASH_EVENT_TYPE_SCROLL, PkeScrollEvent>; constexpr auto FindActivePkeInputAction_WindowFocus_ByType = FindActivePkeInputAction_ByType<PKE_INPUT_HASH_EVENT_TYPE_WINDOW_FOCUS, PkeWindowFocusEvent>; -constexpr auto FindActivePkeInputAction_CursorEnter_ByName = FindActivePkeInputAction_ByName<PKE_INPUT_HASH_EVENT_TYPE_CURSOR_ENTER, PkeCursorEnterEvent>; -constexpr auto FindActivePkeInputAction_CursorPos_ByName = FindActivePkeInputAction_ByName<PKE_INPUT_HASH_EVENT_TYPE_CURSOR_POS, PkeCursorPosEvent>; -constexpr auto FindActivePkeInputAction_Key_ByName = FindActivePkeInputAction_ByName<PKE_INPUT_HASH_EVENT_TYPE_KEY, PkeKeyEvent>; -constexpr auto FindActivePkeInputAction_MouseButton_ByName = FindActivePkeInputAction_ByName<PKE_INPUT_HASH_EVENT_TYPE_MOUSE_BUTTON, PkeMouseButtonEvent>; -constexpr auto FindActivePkeInputAction_Scroll_ByName = FindActivePkeInputAction_ByName<PKE_INPUT_HASH_EVENT_TYPE_SCROLL, PkeScrollEvent>; -constexpr auto FindActivePkeInputAction_WindowFocus_ByName = FindActivePkeInputAction_ByName<PKE_INPUT_HASH_EVENT_TYPE_WINDOW_FOCUS, PkeWindowFocusEvent>; +// constexpr auto FindActivePkeInputAction_CursorEnter_ByName = FindActivePkeInputAction_ByName<PKE_INPUT_HASH_EVENT_TYPE_CURSOR_ENTER, PkeCursorEnterEvent>; +// constexpr auto FindActivePkeInputAction_CursorPos_ByName = FindActivePkeInputAction_ByName<PKE_INPUT_HASH_EVENT_TYPE_CURSOR_POS, PkeCursorPosEvent>; +// constexpr auto FindActivePkeInputAction_Key_ByName = FindActivePkeInputAction_ByName<PKE_INPUT_HASH_EVENT_TYPE_KEY, PkeKeyEvent>; +// constexpr auto FindActivePkeInputAction_MouseButton_ByName = FindActivePkeInputAction_ByName<PKE_INPUT_HASH_EVENT_TYPE_MOUSE_BUTTON, PkeMouseButtonEvent>; +// constexpr auto FindActivePkeInputAction_Scroll_ByName = FindActivePkeInputAction_ByName<PKE_INPUT_HASH_EVENT_TYPE_SCROLL, PkeScrollEvent>; +// constexpr auto FindActivePkeInputAction_WindowFocus_ByName = FindActivePkeInputAction_ByName<PKE_INPUT_HASH_EVENT_TYPE_WINDOW_FOCUS, PkeWindowFocusEvent>; void PkeInput_Tick(double delta) { + (void)delta; // reset everything // @performance could happen concurrently { @@ -575,50 +573,50 @@ void PkeInput_ActivateSet(InputActionSetHandle handle) { // Maybe you just have to restrict certain actions to certain input types if ((action.primaryHash.computedHash & PKE_INPUT_HASH_EVENT_TYPE_CURSOR_ENTER) != InputEventHash{0}) { action.eventIndex = registeredCursorEnterEvents.Count(); - registeredCursorEnterEvents.Push(PkeCursorEnterEvent { - .sourceSet = handle, - .isEntered = lastCursorEntered, - }); + PkeCursorEnterEvent ev{}; + ev.sourceSet = handle; + ev.isEntered = lastCursorEntered; + registeredCursorEnterEvents.Push(ev); } if ((action.primaryHash.computedHash & PKE_INPUT_HASH_EVENT_TYPE_CURSOR_POS) != InputEventHash{0}) { action.eventIndex = registeredCursorPosEvents.Count(); - registeredCursorPosEvents.Push(PkeCursorPosEvent { - .sourceSet = handle, - .xMotion = 0, - .yMotion = 0, - }); + PkeCursorPosEvent ev {}; + ev.sourceSet = handle; + ev.xMotion = 0; + ev.yMotion = 0; + registeredCursorPosEvents.Push(ev); glfwGetCursorPos(window, &lastMousePos.x, &lastMousePos.y); } if ((action.primaryHash.computedHash & PKE_INPUT_HASH_EVENT_TYPE_KEY) != InputEventHash{0}) { action.eventIndex = registeredKeyEvents.Count(); - registeredKeyEvents.Push(PkeKeyEvent { - .sourceSet = handle, - .button = action.primaryHash.button, - .mods = action.primaryHash.mods, - }); + PkeKeyEvent ev{}; + ev.sourceSet = handle; + ev.button = action.primaryHash.button; + ev.mods = action.primaryHash.mods; + registeredKeyEvents.Push(ev); } if ((action.primaryHash.computedHash & PKE_INPUT_HASH_EVENT_TYPE_MOUSE_BUTTON) != InputEventHash{0}) { action.eventIndex = registeredMouseButtonEvents.Count(); - registeredMouseButtonEvents.Push(PkeMouseButtonEvent { - .sourceSet = handle, - .button = action.primaryHash.button, - .mods = action.primaryHash.mods, - }); + PkeMouseButtonEvent ev{}; + ev.sourceSet = handle; + ev.button = action.primaryHash.button; + ev.mods = action.primaryHash.mods; + registeredMouseButtonEvents.Push(ev); } if ((action.primaryHash.computedHash & PKE_INPUT_HASH_EVENT_TYPE_SCROLL) != InputEventHash{0}) { action.eventIndex = registeredScrollEvents.Count(); - registeredScrollEvents.Push(PkeScrollEvent { - .sourceSet = handle, - .xMotion = 0, - .yMotion = 0, - }); + PkeScrollEvent ev{}; + ev.sourceSet = handle; + ev.xMotion = 0; + ev.yMotion = 0; + registeredScrollEvents.Push(ev); } if ((action.primaryHash.computedHash & PKE_INPUT_HASH_EVENT_TYPE_WINDOW_FOCUS) != InputEventHash{0}) { action.eventIndex = registeredWindowFocusEvents.Count(); - registeredWindowFocusEvents.Push(PkeWindowFocusEvent { - .sourceSet = handle, - .isFocused = lastWindowFocus, - }); + PkeWindowFocusEvent ev{}; + ev.sourceSet = handle; + ev.isFocused = lastWindowFocus; + registeredWindowFocusEvents.Push(ev); } } } |
