File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 11#include " WindowMan.h"
22#include " RTEError.h"
3- #include " SDL3/SDL_error.h"
4- #include " SDL3/SDL_video.h"
3+ #include " SDL3/SDL.h"
54#include " SettingsMan.h"
65#include " FrameMan.h"
76#include " ActivityMan.h"
@@ -155,6 +154,8 @@ void WindowMan::Initialize() {
155154 } else {
156155 SetViewportLetterboxed ();
157156 }
157+
158+ SDL_AddEventWatch ((SDL_EventFilter)WindowMan::HandleWindowExposedEvent, nullptr );
158159}
159160
160161void WindowMan::CreatePrimaryWindow () {
@@ -674,6 +675,14 @@ void WindowMan::DisplaySwitchOut() const {
674675 SDL_SetCursor (nullptr );
675676}
676677
678+ void WindowMan::HandleWindowExposedEvent (void *userdata, SDL_Event *event) {
679+ if (event->type == SDL_EVENT_WINDOW_EXPOSED) {
680+ g_WindowMan.SetViewportLetterboxed ();
681+ g_WindowMan.ClearBackbuffer (false );
682+ g_WindowMan.UploadFrame ();
683+ }
684+ }
685+
677686void WindowMan::QueueWindowEvent (const SDL_Event& windowEvent) {
678687 m_EventQueue.emplace_back (windowEvent);
679688}
Original file line number Diff line number Diff line change @@ -168,6 +168,9 @@ namespace RTE {
168168#pragma endregion
169169
170170#pragma region Concrete Methods
171+ // / SDL_EventFilter to hadnle window exposed events for live resize.
172+ static void HandleWindowExposedEvent (void * userdata, SDL_Event* event);
173+
171174 // / Adds an SDL_Event to the Event queue for processing on Update.
172175 // / @param windowEvent The SDL window event to queue.
173176 void QueueWindowEvent (const SDL_Event& windowEvent);
You can’t perform that action at this time.
0 commit comments