diff options
Diffstat (limited to 'src/crepe/system/InputSystem.h')
-rw-r--r-- | src/crepe/system/InputSystem.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/crepe/system/InputSystem.h b/src/crepe/system/InputSystem.h index 87e86f8..3703635 100644 --- a/src/crepe/system/InputSystem.h +++ b/src/crepe/system/InputSystem.h @@ -1,5 +1,6 @@ #pragma once +#include "../api/Config.h" #include "../facade/SDLContext.h" #include "../types.h" #include "../util/OptionalRef.h" @@ -37,8 +38,8 @@ private: //! Stores the last mouse button pressed. MouseButton last_mouse_button = MouseButton::NONE; - //! The maximum allowable distance between mouse down and mouse up to register as a click. - const int click_tolerance = 5; + //! The maximum allowable distance between mouse down and mouse up to register as a click. This can be changed using the Config. + int click_tolerance = Config::get_instance().input.click_tolerance; /** * \brief Handles the mouse click event. @@ -48,8 +49,7 @@ private: * * This method processes the mouse click event and triggers the corresponding button action. */ - void handle_click(const MouseButton & mouse_button, const int world_mouse_x, - const int world_mouse_y); + void handle_click(const MouseButton & mouse_button,const ivec2& mouse_pos); /** * \brief Handles the mouse movement event. @@ -59,8 +59,7 @@ private: * * This method processes the mouse movement event and updates the button hover state. */ - void handle_move(const SDLContext::EventData & event_data, const int world_mouse_x, - const int world_mouse_y); + void handle_move(const SDLContext::EventData & event_data, const ivec2& mouse_pos); /** * \brief Checks if the mouse position is inside the bounds of the button. @@ -70,7 +69,7 @@ private: * \param transform The transform component of the button. * \return True if the mouse is inside the button, false otherwise. */ - bool is_mouse_inside_button(const int world_mouse_x, const int world_mouse_y, + bool is_mouse_inside_button(const ivec2& mouse_pos, const Button & button, const Transform & transform); /** |