make resizing of window when changing resolution smarter

This commit is contained in:
Tim Felgentreff 2020-12-13 19:13:31 +01:00
parent 8d8bf4af78
commit f214984e18

View file

@ -267,10 +267,16 @@ void CVideo::ClearScreen()
bool CVideo::ResizeScreen(int w, int h)
{
if (!(SDL_GetWindowFlags(TheWindow) & SDL_WINDOW_FULLSCREEN_DESKTOP)
&& Video.Width == Video.WindowWidth
&& Video.Height == Video.WindowHeight) {
// if initially window was the same size as res, keep it that way
SDL_SetWindowSize(TheWindow, w, h);
&& Width == WindowWidth
&& Height == WindowHeight) {
// if initially window was the same size as res, keep it that way, unless we've resized
int ww, wh;
SDL_GetWindowSize(TheWindow, &ww, &wh);
if (ww == Width && wh == Height) {
WindowWidth = w;
WindowHeight = h;
SDL_SetWindowSize(TheWindow, w, h);
}
}
Width = w;
Height = h;