aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/SDLContext.h
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-07 20:39:19 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-07 20:39:19 +0100
commit666292e33d6997a61d9eaff31e8180a602656474 (patch)
treedfe0f1cca9b3f8cecf0467fc598598caa32027af /src/crepe/facade/SDLContext.h
parentfdb4c99e139a264d4e15e6913a3756fc6cccb2f2 (diff)
save
Diffstat (limited to 'src/crepe/facade/SDLContext.h')
-rw-r--r--src/crepe/facade/SDLContext.h35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h
index e232511..1f83985 100644
--- a/src/crepe/facade/SDLContext.h
+++ b/src/crepe/facade/SDLContext.h
@@ -79,19 +79,37 @@ public:
KEYUP,
KEYDOWN,
SHUTDOWN,
-
+ WINDOW_MINIMIZE,
+ WINDOW_MAXIMIZE,
+ WINDOW_FOCUS_GAIN,
+ WINDOW_FOCUS_LOST,
+ WINDOW_MOVE,
+ WINDOW_RESIZE,
+ WINDOW_EXPOSE,
};
- //! EventData struct for passing event data from facade
- struct EventData {
- SDLContext::EventType event_type = SDLContext::EventType::NONE;
+ struct KeyData{
Keycode key = Keycode::NONE;
bool key_repeat = false;
+ };
+ struct MouseData{
MouseButton mouse_button = MouseButton::NONE;
ivec2 mouse_position = {-1, -1};
int scroll_direction = -1;
float scroll_delta = INFINITY;
ivec2 rel_mouse_move = {-1, -1};
};
+ struct WindowData{
+ ivec2 move_delta;
+ ivec2 resize_dimension;
+ };
+ //! EventData struct for passing event data from facade
+ struct EventData {
+ SDLContext::EventType event_type = SDLContext::EventType::NONE;
+ KeyData key_data;
+ MouseData mouse_data;
+ WindowData window_data;
+ };
+
/**
* \brief Gets the singleton instance of SDLContext.
* \return Reference to the SDLContext instance.
@@ -116,7 +134,14 @@ private:
* \return Events that occurred since last call to `get_events()`
*/
std::vector<SDLContext::EventData> get_events();
-
+ /**
+ * \brief Fills event_list with triggered window events
+ *
+ * This method checks if any window events are triggered and adds them to the event_list.
+ *
+ */
+ void handle_window_event(const SDL_WindowEvent& window_event,
+ std::vector<SDLContext::EventData>& event_list);
/**
* \brief Converts an SDL key code to the custom Keycode type.
*