diff --git a/include/Cubed/input/key.hpp b/include/Cubed/input/key.hpp index 847ce60..8d01abf 100644 --- a/include/Cubed/input/key.hpp +++ b/include/Cubed/input/key.hpp @@ -123,5 +123,5 @@ enum class Key { NUMPAD_DECIMAL, // . NUMPAD_ENTER }; -enum class KeyAction { PRESS, RELEASE }; +enum class KeyAction { PRESS, RELEASE, REPEAT }; } // namespace Cubed \ No newline at end of file diff --git a/src/app.cpp b/src/app.cpp index 438aa2b..599b024 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -521,10 +521,12 @@ void App::key_callback(GLFWwindow* window, int key, int scancode, int action, return; } - if (action == GLFW_PRESS || action == GLFW_REPEAT) { + if (action == GLFW_PRESS) { act = KeyAction::PRESS; - } else { + } else if (action == GLFW_RELEASE) { act = KeyAction::RELEASE; + } else { + act = KeyAction::REPEAT; } app->dispatch_event(KeyEvent{pkey, act}); @@ -570,10 +572,12 @@ void App::mouse_button_callback(GLFWwindow* window, int button, int action, Logger::error("Unknown Mouse Button {}", button); return; } - if (action == GLFW_PRESS || action == GLFW_REPEAT) { + if (action == GLFW_PRESS) { act = KeyAction::PRESS; - } else { + } else if (action == GLFW_RELEASE) { act = KeyAction::RELEASE; + } else { + act = KeyAction::REPEAT; } app->dispatch_event(MouseButtonEvent{key, act});