Do not call gfx_sdl_set_fullscreen() just after creating the game window: create window fullscreen or not directly.

This commit is contained in:
vanfanel 2020-05-10 18:07:26 +02:00
parent 4fb20a14b6
commit 2056beeaff
1 changed files with 13 additions and 5 deletions

View File

@ -95,6 +95,8 @@ static void gfx_sdl_set_fullscreen(bool fullscreen)
}
static void gfx_sdl_init(void) {
Uint32 window_flags = 0;
SDL_Init(SDL_INIT_VIDEO);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
@ -109,19 +111,25 @@ static void gfx_sdl_init(void) {
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE;
if (configFullscreen) {
window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}
#ifndef USE_GLES
wnd = SDL_CreateWindow("Super Mario 64 PC port (OpenGL)", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, window_flags);
#else
/* GLES platforms generally run without a window server like Xorg. Just use the system video mode,
instead of trying to set a new video mode, which does not make any sense in modern displays. */
SDL_DisplayMode sdl_displaymode;
SDL_GetCurrentDisplayMode(0, &sdl_displaymode);
wnd = SDL_CreateWindow("Super Mario 64 PC port (OpenGL_ES2)", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
sdl_displaymode.w, sdl_displaymode.h, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN_DESKTOP);
#endif
gfx_sdl_set_fullscreen(configFullscreen);
wnd = SDL_CreateWindow("Super Mario 64 PC port (OpenGL_ES2)", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
sdl_displaymode.w, sdl_displaymode.h, window_flags);
#endif
SDL_GL_CreateContext(wnd);
SDL_GL_SetSwapInterval(1); // We have a double buffered GL context, it makes no sense to want tearing.