File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 1
1
#include " WindowMan.h"
2
2
#include " RTEError.h"
3
- #include " SDL3/SDL_error.h"
4
- #include " SDL3/SDL_video.h"
3
+ #include " SDL3/SDL.h"
5
4
#include " SettingsMan.h"
6
5
#include " FrameMan.h"
7
6
#include " ActivityMan.h"
@@ -155,6 +154,10 @@ void WindowMan::Initialize() {
155
154
} else {
156
155
SetViewportLetterboxed ();
157
156
}
157
+
158
+ #ifdef _WIN32
159
+ SDL_AddEventWatch ((SDL_EventFilter)WindowMan::HandleWindowExposedEvent, nullptr );
160
+ #endif
158
161
}
159
162
160
163
void WindowMan::CreatePrimaryWindow () {
@@ -674,6 +677,15 @@ void WindowMan::DisplaySwitchOut() const {
674
677
SDL_SetCursor (nullptr );
675
678
}
676
679
680
+ void WindowMan::HandleWindowExposedEvent (void *userdata, SDL_Event *event) {
681
+ if (event->type == SDL_EVENT_WINDOW_EXPOSED) {
682
+ g_WindowMan.SetViewportLetterboxed ();
683
+ g_WindowMan.ClearBackbuffer (false );
684
+ g_WindowMan.UploadFrame ();
685
+ g_WindowMan.Present ();
686
+ }
687
+ }
688
+
677
689
void WindowMan::QueueWindowEvent (const SDL_Event& windowEvent) {
678
690
m_EventQueue.emplace_back (windowEvent);
679
691
}
@@ -722,6 +734,7 @@ void WindowMan::Update() {
722
734
case SDL_EVENT_WINDOW_RESIZED:
723
735
case SDL_WINDOW_MAXIMIZED:
724
736
SetViewportLetterboxed ();
737
+ std::cout << " resize" << std::endl;
725
738
break ;
726
739
default :
727
740
break ;
Original file line number Diff line number Diff line change @@ -168,6 +168,9 @@ namespace RTE {
168
168
#pragma endregion
169
169
170
170
#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
+
171
174
// / Adds an SDL_Event to the Event queue for processing on Update.
172
175
// / @param windowEvent The SDL window event to queue.
173
176
void QueueWindowEvent (const SDL_Event& windowEvent);
You can’t perform that action at this time.
0 commit comments