aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/InputSystem.h
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-13 09:15:56 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-13 09:15:56 +0100
commit2b3659c8c5dace0ff9ff9cb8b9421f7f3f890218 (patch)
tree5a051d3d11c2bb358b170735b0bcdee0e997aa25 /src/crepe/system/InputSystem.h
parent2793e8be0e6c44bb34a25522e1e75ed8a2868b32 (diff)
added window events back to code and function cleanup
Diffstat (limited to 'src/crepe/system/InputSystem.h')
-rw-r--r--src/crepe/system/InputSystem.h37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/crepe/system/InputSystem.h b/src/crepe/system/InputSystem.h
index 3703635..7b8f510 100644
--- a/src/crepe/system/InputSystem.h
+++ b/src/crepe/system/InputSystem.h
@@ -32,15 +32,36 @@ public:
private:
//! Stores the last position of the mouse when the button was pressed.
- ivec2 last_mouse_down_position;
+ vec2 last_mouse_down_position;
// TODO: specify world/hud space and make regular `vec2`
//! 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. This can be changed using the Config.
- int click_tolerance = Config::get_instance().input.click_tolerance;
-
+ /**
+ * \brief Determines whether the given event type is a mouse event.
+ * \param event_type The event type to check.
+ * \return True if the event type corresponds to a mouse event, false otherwise.
+ */
+ bool is_mouse_event(SDLContext::EventType event_type);
+ /**
+ * \brief Handles mouse-related events.
+ * \param event The event data for the mouse event.
+ * \param camera_origin The origin position of the camera in world space.
+ * \param current_cam The currently active camera.
+ *
+ * This method processes mouse events, adjusts the mouse position to world coordinates,
+ * and triggers the appropriate mouse-specific event handling logic.
+ */
+ void handle_mouse_event(const SDLContext::EventData &event, const vec2 &camera_origin,
+ const Camera &current_cam);
+ /**
+ * \brief Handles non-mouse-related events.
+ * \param event The event data for the non-mouse event.
+ *
+ * This method processes events that do not involve the mouse, such as keyboard events,
+ * window events, and shutdown events, and triggers the corresponding event actions.
+ */
+ void handle_non_mouse_event(const SDLContext::EventData &event);
/**
* \brief Handles the mouse click event.
* \param mouse_button The mouse button involved in the click.
@@ -49,7 +70,7 @@ private:
*
* This method processes the mouse click event and triggers the corresponding button action.
*/
- void handle_click(const MouseButton & mouse_button,const ivec2& mouse_pos);
+ void handle_click(const MouseButton & mouse_button,const vec2& mouse_pos);
/**
* \brief Handles the mouse movement event.
@@ -59,7 +80,7 @@ private:
*
* This method processes the mouse movement event and updates the button hover state.
*/
- void handle_move(const SDLContext::EventData & event_data, const ivec2& mouse_pos);
+ void handle_move(const SDLContext::EventData & event_data, const vec2& mouse_pos);
/**
* \brief Checks if the mouse position is inside the bounds of the button.
@@ -69,7 +90,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 ivec2& mouse_pos,
+ bool is_mouse_inside_button(const vec2& mouse_pos,
const Button & button, const Transform & transform);
/**