diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-04 20:12:34 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-04 20:12:34 +0100 |
commit | 6454975779acb39d7d546e11855a07a952e68e5b (patch) | |
tree | 3c13741ebbeb36f4df85654b232dcfbce8c66e4b /src/crepe/facade | |
parent | b0a7296eb4319d123c88b34f162c28d0717c98e4 (diff) |
loeks feedback changes
Diffstat (limited to 'src/crepe/facade')
-rw-r--r-- | src/crepe/facade/SDLContext.cpp | 3 | ||||
-rw-r--r-- | src/crepe/facade/SDLContext.h | 19 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index a657373..aba7ce7 100644 --- a/src/crepe/facade/SDLContext.cpp +++ b/src/crepe/facade/SDLContext.cpp @@ -393,7 +393,8 @@ std::vector<SDLContext::EventData> SDLContext::get_events() { event_list.push_back(EventData{ .event_type = SDLContext::EventType::MOUSEWHEEL, .mouse_position = {event.motion.x, event.motion.y}, - .wheel_delta = event.wheel.y, + .scroll_direction = event.wheel.direction, + .scroll_delta = event.wheel.preciseY, }); } break; } diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h index 2228950..bd0427a 100644 --- a/src/crepe/facade/SDLContext.h +++ b/src/crepe/facade/SDLContext.h @@ -62,7 +62,8 @@ public: bool key_repeat = false; MouseButton mouse_button = MouseButton::NONE; std::pair<int, int> mouse_position = {-1, -1}; - int wheel_delta = -1; + int scroll_direction = -1; + float scroll_delta = INFINITY; std::pair<int, int> rel_mouse_move = {-1, -1}; }; /** @@ -80,35 +81,35 @@ private: //! will only use get_events friend class InputSystem; /** - * @brief Retrieves a list of all events from the SDL context. + * \brief Retrieves a list of all events from the SDL context. * * This method retrieves all the events from the SDL context that are currently * available. It is primarily used by the InputSystem to process various * input events such as mouse clicks, mouse movements, and keyboard presses. * - * @return A vector of `SDLContext::EventData` containing the events. + * \return Events that occurred since last call to `get_events()` */ std::vector<SDLContext::EventData> get_events(); /** - * @brief Converts an SDL key code to the custom Keycode type. + * \brief Converts an SDL key code to the custom Keycode type. * * This method maps an SDL key code to the corresponding `Keycode` enum value, * which is used internally by the system to identify the keys. * - * @param sdl_key The SDL key code to convert. - * @return The corresponding `Keycode` value. + * \param sdl_key The SDL key code to convert. + * \return The corresponding `Keycode` value or `Keycode::NONE` if the key is unrecognized. */ Keycode sdl_to_keycode(SDL_Keycode sdl_key); /** - * @brief Converts an SDL mouse button code to the custom MouseButton type. + * \brief Converts an SDL mouse button code to the custom MouseButton type. * * This method maps an SDL mouse button code to the corresponding `MouseButton` * enum value, which is used internally by the system to identify mouse buttons. * - * @param sdl_button The SDL mouse button code to convert. - * @return The corresponding `MouseButton` value. + * \param sdl_button The SDL mouse button code to convert. + * \return The corresponding `MouseButton` value or `MouseButton::NONE` if the key is unrecognized */ MouseButton sdl_to_mousebutton(Uint8 sdl_button); |