]> git.mxchange.org Git - quix0rs-blobwars.git/commitdiff
Delay switching to fullscreen mode.
authorGuus Sliepen <Guus.Sliepen@astro.su.se>
Tue, 1 Oct 2013 12:26:50 +0000 (14:26 +0200)
committerGuus Sliepen <Guus.Sliepen@astro.su.se>
Tue, 1 Oct 2013 12:26:50 +0000 (14:26 +0200)
If we make the window fullscreen too early during program start, then turning
fullscreen off will not change the window size back to 640x480 pixels.

src/init.cpp

index 126fb792c2a9875cb04d231000e69432a473c8b6..10e7aeb4bef92c2b30c1bcfe57e85dae0c66aa5f 100644 (file)
@@ -281,7 +281,6 @@ void initSystem()
        graphics.screen = SDL_CreateRGBSurface(0, 640, 480, 32, 0xff0000, 0xff00, 0xff, 0xff000000);
 
        graphics.window = SDL_CreateWindow("Blobwars: Metal Blob Solid", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, graphics.screen->w, graphics.screen->h, 0);
-       SDL_SetWindowFullscreen(graphics.window, engine.fullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
        graphics.renderer = SDL_CreateRenderer(graphics.window, -1, 0);
        SDL_RenderSetLogicalSize(graphics.renderer, graphics.screen->w, graphics.screen->h);
        graphics.texture = SDL_CreateTexture(graphics.renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, graphics.screen->w, graphics.screen->h);
@@ -292,6 +291,8 @@ void initSystem()
                exit(1);
        }
 
+       SDL_SetWindowFullscreen(graphics.window, engine.fullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
+
        // This (attempts to) set the gamma correction. We attempt to catch an error here
        // in case someone has done something really stupid in the config file(!!)
        if (game.brightness != -1) {