diff --git a/src/gx/glsdl/GLSDLWindow.cpp b/src/gx/glsdl/GLSDLWindow.cpp index d45aea7..9438890 100644 --- a/src/gx/glsdl/GLSDLWindow.cpp +++ b/src/gx/glsdl/GLSDLWindow.cpp @@ -2,6 +2,7 @@ #include "event/Types.hpp" #include "event/Input.hpp" #include "event/Event.hpp" +#include "gx/Window.hpp" #include #include @@ -287,6 +288,9 @@ void GLSDLWindow::DispatchSDLEvent(const SDL_Event& event) { case SDL_EVENT_TEXT_INPUT: this->DispatchSDLTextInputEvent(event); break; + case SDL_EVENT_WINDOW_RESIZED: + this->DispatchSDLWindowResizedEvent(event); + break; case SDL_EVENT_QUIT: EventPostClose(); break; @@ -363,3 +367,19 @@ void GLSDLWindow::DispatchSDLTextInputEvent(const SDL_Event& event) { text += charactersize; } } + +void GLSDLWindow::DispatchSDLWindowResizedEvent(const SDL_Event& event) { + auto width = static_cast(event.window.data1); + auto height = static_cast(event.window.data2); + + OsQueuePut(OS_INPUT_SIZE, width, height, 0, 0); + + auto bounds = GetSavedWindowBounds(); + Rect newBounds = { + bounds->top, + bounds->left, + static_cast(bounds->top + height), + static_cast(bounds->left + width) + }; + SetSavedWindowBounds(newBounds); +} diff --git a/src/gx/glsdl/GLSDLWindow.hpp b/src/gx/glsdl/GLSDLWindow.hpp index a0a288f..4897743 100644 --- a/src/gx/glsdl/GLSDLWindow.hpp +++ b/src/gx/glsdl/GLSDLWindow.hpp @@ -35,6 +35,7 @@ class GLSDLWindow { void DispatchSDLMouseMotionEvent(const SDL_Event& event); void DispatchSDLMouseButtonEvent(const SDL_Event& event); void DispatchSDLTextInputEvent(const SDL_Event& event); + void DispatchSDLWindowResizedEvent(const SDL_Event& event); void Resize(const GLSDLWindowRect& rect); GLSDLWindowRect GetRect();