sdl-1.2: return to original dimensions on fullscreen exit

This commit is contained in:
Xavier Del Campo Romero 2022-06-11 23:28:16 +02:00
parent a84a55aa25
commit 3f6bf6aa1a
1 changed files with 8 additions and 3 deletions

View File

@ -23,7 +23,7 @@ void gfx_deinit(void)
static struct
{
int w, h;
} display;
} display, windowed;
void gfx_register_sprite(struct sprite *const s)
{
@ -60,6 +60,11 @@ static int resize_screen(int w, int h, const bool full_screen)
w = display.w;
h = display.h;
}
else
{
windowed.w = w;
windowed.h = h;
}
int bpp = info->vfmt->BitsPerPixel;
@ -149,8 +154,8 @@ int gfx_toggle_fullscreen(void)
{
fullscreen ^= true;
const int w = fullscreen ? display.w : screen_w;
const int h = fullscreen ? display.h : screen_h;
const int w = fullscreen ? display.w : windowed.w;
const int h = fullscreen ? display.h : windowed.h;
if ((resize_screen(w, h, fullscreen)))
return -1;