diff --git a/src/engine/client/ec_gfx.c b/src/engine/client/ec_gfx.c index 5a61f7c72..64840b2b6 100644 --- a/src/engine/client/ec_gfx.c +++ b/src/engine/client/ec_gfx.c @@ -194,6 +194,7 @@ static int try_init() } SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, config.gfx_vsync); /* set caption */ SDL_WM_SetCaption("Teeworlds", "Teeworlds"); @@ -258,7 +259,7 @@ int gfx_init() } atexit(SDL_Quit); - + if(!no_gfx) { #ifdef CONF_FAMILY_WINDOWS @@ -326,8 +327,6 @@ int gfx_init() /*if(config.dbg_stress) gfx_minimize();*/ - /* set vsync as needed */ - gfx_set_vsync(config.gfx_vsync); return 0; } @@ -416,11 +415,6 @@ int gfx_get_video_modes(VIDEO_MODE *list, int maxcount) return num_modes; } -void gfx_set_vsync(int val) -{ - /* TODO: SDL*/ -} - int gfx_unload_texture(int index) { if(index == invalid_texture) diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 15d9e507a..b240c6078 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -497,7 +497,10 @@ void MENUS::render_settings_graphics(RECT main_view) ui_hsplit_t(&main_view, 20.0f, &button, &main_view); if (ui_do_button(&config.gfx_vsync, "V-Sync", config.gfx_vsync, &button, ui_draw_checkbox, 0)) + { config.gfx_vsync ^= 1; + need_restart = true; + } ui_hsplit_t(&main_view, 20.0f, &button, &main_view); if (ui_do_button(&config.gfx_fsaa_samples, "FSAA samples", config.gfx_fsaa_samples, &button, ui_draw_checkbox_number, 0))