From: Ingo Ruhnke Date: Fri, 1 Aug 2014 02:14:41 +0000 (+0200) Subject: Added fullscreen switching to SDLRenderer X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=548a198187ef3a45f1d1a27528a9a6d1646691b5;p=supertux.git Added fullscreen switching to SDLRenderer --- diff --git a/src/video/sdl/sdl_renderer.cpp b/src/video/sdl/sdl_renderer.cpp index e1a149ee3..49f1af1ef 100644 --- a/src/video/sdl/sdl_renderer.cpp +++ b/src/video/sdl/sdl_renderer.cpp @@ -257,7 +257,30 @@ SDLRenderer::apply_config() screen_size = g_config->window_size; } - //apply_video_mode(screen_size, g_config->use_fullscreen); + if (!g_config->use_fullscreen) + { + SDL_SetWindowFullscreen(window, 0); + } + else + { + SDL_DisplayMode mode; + mode.format = SDL_PIXELFORMAT_RGB888; + mode.w = g_config->fullscreen_size.width; + mode.h = g_config->fullscreen_size.height; + mode.refresh_rate = g_config->fullscreen_refresh_rate; + mode.driverdata = 0; + + if (SDL_SetWindowDisplayMode(window, &mode) != 0) + { + log_warning << "failed to set display mode: " + << mode.w << "x" << mode.h << "@" << mode.refresh_rate << ": " + << SDL_GetError() << std::endl; + } + else + { + SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN); + } + } if (target_aspect > 1.0f) {