Port GetWindowSize() to SDL 3.

This commit is contained in:
Yamagi 2024-03-29 10:37:37 +01:00
parent 6f0da6c247
commit 55a1e38717
1 changed files with 3 additions and 8 deletions

View File

@ -32,6 +32,7 @@
* * Do we need to request High DPI modes when vid_highdpiaware > 0? * * Do we need to request High DPI modes when vid_highdpiaware > 0?
* * `fullscreen` should be an enum to make the code more readable. * * `fullscreen` should be an enum to make the code more readable.
* * Debug fullscreen handling, maybe refactor it further. * * Debug fullscreen handling, maybe refactor it further.
* * Check if window size handling is correct.
*/ */
#include "../../common/header/common.h" #include "../../common/header/common.h"
@ -236,18 +237,12 @@ GetWindowSize(int* w, int* h)
return false; return false;
} }
SDL_DisplayMode m; if (SDL_GetWindowSize(window, w, h) < 0)
if (SDL_GetWindowFullscreenMode(window, &m) != 0)
{ {
Com_Printf("Can't get Displaymode: %s\n", SDL_GetError()); Com_Printf("Couldn't get window size: %s\n", SDL_GetError());
return false; return false;
} }
*w = m.w;
*h = m.h;
return true; return true;
} }