mirror of https://github.com/sm64pc/sm64pc.git
no need for that, window resize events happen when fullscreen state changes
This commit is contained in:
parent
58dbb04f97
commit
62cc4620ec
|
@ -45,8 +45,6 @@ static bool window_fullscreen;
|
||||||
static bool window_vsync;
|
static bool window_vsync;
|
||||||
static int window_width, window_height;
|
static int window_width, window_height;
|
||||||
|
|
||||||
static Uint64 frame_time = 0;
|
|
||||||
|
|
||||||
const SDL_Scancode windows_scancode_table[] =
|
const SDL_Scancode windows_scancode_table[] =
|
||||||
{
|
{
|
||||||
/* 0 1 2 3 4 5 6 7 */
|
/* 0 1 2 3 4 5 6 7 */
|
||||||
|
@ -104,10 +102,10 @@ static void gfx_sdl_set_fullscreen(bool fullscreen) {
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
SDL_SetWindowFullscreen(wnd, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
SDL_SetWindowFullscreen(wnd, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
SDL_GetWindowSize(wnd, &window_width, &window_height);
|
|
||||||
} else {
|
} else {
|
||||||
SDL_SetWindowFullscreen(wnd, 0);
|
SDL_SetWindowFullscreen(wnd, 0);
|
||||||
SDL_ShowCursor(SDL_ENABLE);
|
SDL_ShowCursor(SDL_ENABLE);
|
||||||
|
// reset back to small window just in case
|
||||||
window_width = DESIRED_SCREEN_WIDTH;
|
window_width = DESIRED_SCREEN_WIDTH;
|
||||||
window_height = DESIRED_SCREEN_HEIGHT;
|
window_height = DESIRED_SCREEN_HEIGHT;
|
||||||
SDL_SetWindowSize(wnd, window_width, window_height);
|
SDL_SetWindowSize(wnd, window_width, window_height);
|
||||||
|
@ -161,8 +159,6 @@ static void gfx_sdl_init(void) {
|
||||||
|
|
||||||
Uint32 window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE;
|
Uint32 window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE;
|
||||||
|
|
||||||
window_width = DESIRED_SCREEN_WIDTH;
|
|
||||||
window_height = DESIRED_SCREEN_HEIGHT;
|
|
||||||
window_fullscreen = configFullscreen;
|
window_fullscreen = configFullscreen;
|
||||||
|
|
||||||
if (configFullscreen) {
|
if (configFullscreen) {
|
||||||
|
@ -173,11 +169,14 @@ static void gfx_sdl_init(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
wnd = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
wnd = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||||
window_width, window_height, window_flags);
|
DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, window_flags);
|
||||||
|
|
||||||
ctx = SDL_GL_CreateContext(wnd);
|
ctx = SDL_GL_CreateContext(wnd);
|
||||||
SDL_GL_SetSwapInterval(2);
|
SDL_GL_SetSwapInterval(2);
|
||||||
|
|
||||||
|
// in case FULLSCREEN_DESKTOP set our size to god knows what
|
||||||
|
SDL_GetWindowSize(wnd, &window_width, &window_height);
|
||||||
|
|
||||||
window_vsync = test_vsync();
|
window_vsync = test_vsync();
|
||||||
if (!window_vsync)
|
if (!window_vsync)
|
||||||
printf("Warning: VSync is not enabled or not working. Falling back to timer for synchronization\n");
|
printf("Warning: VSync is not enabled or not working. Falling back to timer for synchronization\n");
|
||||||
|
|
Loading…
Reference in New Issue