mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
SDL: Support setting vsync at runtime
Allows vid_wait to work under software without having to switch to OpenGL and then back Yeah, support on windows will require a newer version of SDL. I'm just pushing this so the code is already there.
This commit is contained in:
parent
dfadd430b7
commit
512342bf7c
1 changed files with 11 additions and 1 deletions
|
|
@ -106,8 +106,10 @@ rendermode_t chosenrendermode = render_none; // set by command line arguments
|
|||
|
||||
boolean highcolor = false;
|
||||
|
||||
static void Impl_SetVsync(void);
|
||||
|
||||
// synchronize page flipping with screen refresh
|
||||
consvar_t cv_vidwait = CVAR_INIT ("vid_wait", "On", CV_SAVE, CV_OnOff, NULL);
|
||||
consvar_t cv_vidwait = CVAR_INIT ("vid_wait", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Impl_SetVsync);
|
||||
static consvar_t cv_stretch = CVAR_INIT ("stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL);
|
||||
static consvar_t cv_alwaysgrabmouse = CVAR_INIT ("alwaysgrabmouse", "Off", CV_SAVE, CV_OnOff, NULL);
|
||||
|
||||
|
|
@ -2061,3 +2063,11 @@ void I_ShutdownGraphics(void)
|
|||
framebuffer = SDL_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void Impl_SetVsync(void)
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(2,0,18)
|
||||
if (renderer)
|
||||
SDL_RenderSetVSync(renderer, cv_vidwait.value);
|
||||
#endif
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue