From 5145f2a89771d300bc66059be28c042a8ea55bad Mon Sep 17 00:00:00 2001 From: IvanDSM Date: Sat, 16 May 2020 21:53:00 -0300 Subject: [PATCH] Fix --fullscreen/--windowed CLI option altering config file. Previously, when the --fullscreen or --windowed CLI options were set, configFullscreen was overwritten. This caused the config file to be changed according to the CLI options given when running the executable. A helper variable that copies configFullscreen stops the game from overwritting the config file. --- src/pc/gfx/gfx_sdl2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pc/gfx/gfx_sdl2.c b/src/pc/gfx/gfx_sdl2.c index 2a0a54dd..31fb9ff6 100644 --- a/src/pc/gfx/gfx_sdl2.c +++ b/src/pc/gfx/gfx_sdl2.c @@ -97,6 +97,7 @@ static void gfx_sdl_set_fullscreen(bool fullscreen) { static void gfx_sdl_init(void) { Uint32 window_flags = 0; + u8 Fullscreen; SDL_Init(SDL_INIT_VIDEO); @@ -114,12 +115,13 @@ static void gfx_sdl_init(void) { window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE; + Fullscreen = configFullscreen; if (gCLIOpts.FullScreen == 1) - configFullscreen = true; + Fullscreen = true; else if (gCLIOpts.FullScreen == 2) - configFullscreen = false; + Fullscreen = false; - if (configFullscreen) { + if (Fullscreen) { window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; }