diff options
| -rw-r--r-- | src/player-input.cpp | 15 | ||||
| -rw-r--r-- | src/player-input.hpp | 4 |
2 files changed, 8 insertions, 11 deletions
diff --git a/src/player-input.cpp b/src/player-input.cpp index 9f50307..1e87093 100644 --- a/src/player-input.cpp +++ b/src/player-input.cpp @@ -284,14 +284,14 @@ void PkeInput_Tick(double delta) { auto &ev = registeredKeyEvents[i]; // TODO the idea here was right, but wrong place and too wide a swath // if (i < count - 1) ev.isPressed = false; - ev.pressCount = 0; + ev.thisTick = false; } count = registeredMouseButtonEvents.Count(); for (int64_t i = 0; i < count; ++i) { auto &ev = registeredMouseButtonEvents[i]; // TODO the idea here was right, but wrong place and too wide a swath // if (i < count - 1) ev.isPressed = false; - ev.pressCount = 0; + ev.thisTick = false; } count = registeredScrollEvents.Count(); for (int64_t i = 0; i < count; ++i) { @@ -348,15 +348,13 @@ void PkeInput_Tick(double delta) { } if (ev.action == GLFW_PRESS) { primaryEvent->isPressed = true; + primaryEvent->thisTick = true; } else if (ev.action == GLFW_RELEASE) { - if (primaryEvent->isPressed == true) { - primaryEvent->pressCount += 1; - } primaryEvent->isPressed = false; + primaryEvent->thisTick = true; } else { // repeat primaryEvent->isPressed = true; - primaryEvent->pressCount += 1; } } } while (0); @@ -375,11 +373,10 @@ void PkeInput_Tick(double delta) { } if (ev.action == GLFW_PRESS) { primaryEvent->isPressed = true; + primaryEvent->thisTick = true; } else if (ev.action == GLFW_RELEASE) { - if (primaryEvent->isPressed == true) { - primaryEvent->pressCount += 1; - } primaryEvent->isPressed = false; + primaryEvent->thisTick = true; } } } while (0); diff --git a/src/player-input.hpp b/src/player-input.hpp index a44ae42..59d2c75 100644 --- a/src/player-input.hpp +++ b/src/player-input.hpp @@ -72,14 +72,14 @@ struct PkeCursorPosEvent : public PkeInputEventBase { struct PkeKeyEvent : public PkeInputEventBase { InputActionSetHandle sourceSet; bool isPressed; - int8_t pressCount; + bool thisTick; int32_t button; int32_t mods; }; struct PkeMouseButtonEvent : public PkeInputEventBase { InputActionSetHandle sourceSet; bool isPressed; - int8_t pressCount; + bool thisTick; int32_t button; int32_t mods; }; |
