1
1
#include " WindowMan.h"
2
+ #include " RTEError.h"
3
+ #include " SDL3/SDL_error.h"
4
+ #include " SDL3/SDL_video.h"
2
5
#include " SettingsMan.h"
3
6
#include " FrameMan.h"
4
7
#include " ActivityMan.h"
@@ -96,7 +99,20 @@ void WindowMan::Destroy() {
96
99
void WindowMan::Initialize () {
97
100
SDL_free (SDL_GetDisplays (&m_NumDisplays));
98
101
99
- SDL_Rect currentDisplayBounds;
102
+ m_PrimaryWindowDisplayIndex = SDL_GetPrimaryDisplay ();
103
+ if (m_PrimaryWindowDisplayIndex == 0 ) {
104
+ g_ConsoleMan.PrintString (" ERROR: Failed to get primary display!" + std::string (SDL_GetError ()));
105
+ int count{0 };
106
+ SDL_DisplayID* displays = SDL_GetDisplays (&count);
107
+ if (displays) {
108
+ m_PrimaryWindowDisplayIndex = displays[0 ];
109
+ } else {
110
+ RTEAbort (" No displays detetected somehow! " + std::string (SDL_GetError ()));
111
+ }
112
+ SDL_free (displays);
113
+ }
114
+
115
+ SDL_Rect currentDisplayBounds{};
100
116
SDL_GetDisplayBounds (m_PrimaryWindowDisplayIndex, ¤tDisplayBounds);
101
117
102
118
m_PrimaryWindowDisplayWidth = currentDisplayBounds.w ;
@@ -160,7 +176,6 @@ void WindowMan::CreatePrimaryWindow() {
160
176
161
177
int windowPosX = (m_ResX * m_ResMultiplier <= m_PrimaryWindowDisplayWidth) ? SDL_WINDOWPOS_CENTERED : (m_MaxResX - (m_ResX * m_ResMultiplier)) / 2 ;
162
178
int windowPosY = SDL_WINDOWPOS_CENTERED;
163
- int windowFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE;
164
179
165
180
SDL_PropertiesID windowProps = SDL_CreateProperties ();
166
181
RTEAssert (windowProps, " Unable to create window properties! " + std::string (SDL_GetError ()));
@@ -800,4 +815,4 @@ void WindowMan::Present() {
800
815
SDL_GL_SwapWindow (m_MultiDisplayWindows.at (i).get ());
801
816
}
802
817
}
803
- }
818
+ }
0 commit comments