From 16fda1ef8da96c44cec20225cc4427d8eec52827 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Thu, 5 Dec 2024 13:54:01 +0100 Subject: feedback changes --- src/crepe/api/UIObject.h | 1 - src/crepe/facade/SDLContext.h | 4 ++-- src/crepe/system/InputSystem.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src/crepe') diff --git a/src/crepe/api/UIObject.h b/src/crepe/api/UIObject.h index 614794d..c8987dc 100644 --- a/src/crepe/api/UIObject.h +++ b/src/crepe/api/UIObject.h @@ -5,7 +5,6 @@ namespace crepe { /** - * @class UiObject * \brief Represents a UI object in the game, derived from the Component class. */ class UIObject : public Component { diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h index bd0427a..a2b34c1 100644 --- a/src/crepe/facade/SDLContext.h +++ b/src/crepe/facade/SDLContext.h @@ -61,10 +61,10 @@ public: Keycode key = Keycode::NONE; bool key_repeat = false; MouseButton mouse_button = MouseButton::NONE; - std::pair mouse_position = {-1, -1}; + ivec2 mouse_position = {-1, -1}; int scroll_direction = -1; float scroll_delta = INFINITY; - std::pair rel_mouse_move = {-1, -1}; + ivec2 rel_mouse_move = {-1, -1}; }; /** * \brief Gets the singleton instance of SDLContext. diff --git a/src/crepe/system/InputSystem.cpp b/src/crepe/system/InputSystem.cpp index d24a33d..4a7f115 100644 --- a/src/crepe/system/InputSystem.cpp +++ b/src/crepe/system/InputSystem.cpp @@ -31,8 +31,8 @@ void InputSystem::update() { = cam_transform.position.y + current_cam.offset.y - (current_cam.viewport_size.y / 2); for (const SDLContext::EventData & event : event_list) { - int world_mouse_x = event.mouse_position.first + camera_origin_x; - int world_mouse_y = event.mouse_position.second + camera_origin_y; + int world_mouse_x = event.mouse_position.x + camera_origin_x; + int world_mouse_y = event.mouse_position.y + camera_origin_y; // check if the mouse is within the viewport bool mouse_in_viewport = !(world_mouse_x < camera_origin_x @@ -96,8 +96,8 @@ void InputSystem::update() { event_mgr.queue_event(MouseMoveEvent{ .mouse_x = world_mouse_x, .mouse_y = world_mouse_y, - .delta_x = event.rel_mouse_move.first, - .delta_y = event.rel_mouse_move.second, + .delta_x = event.rel_mouse_move.x, + .delta_y = event.rel_mouse_move.y, }); this->handle_move(event, world_mouse_x, world_mouse_y); break; -- cgit v1.2.3