mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add handler for vid_wait
Allows vid_wait to toggle without changing modes
This commit is contained in:
parent
6cbfc5aead
commit
cdde3cca38
2 changed files with 43 additions and 1 deletions
|
|
@ -460,7 +460,14 @@ consvar_t cv_usemouse = Player("use_mouse", "Off").values({{0, "Off"}, {1, "On"}
|
|||
consvar_t cv_vhseffect = Player("vhspause", "On").on_off();
|
||||
|
||||
// synchronize page flipping with screen refresh
|
||||
consvar_t cv_vidwait = GraphicsDriver("vid_wait", "Off").on_off();
|
||||
extern "C++"
|
||||
{
|
||||
namespace srb2::cvarhandler
|
||||
{
|
||||
void on_set_vid_wait();
|
||||
}
|
||||
}
|
||||
consvar_t cv_vidwait = GraphicsDriver("vid_wait", "Off").on_off().onchange(srb2::cvarhandler::on_set_vid_wait);
|
||||
|
||||
// if true, all sounds are loaded at game startup
|
||||
consvar_t precachesound = Player("precachesound", "Off").on_off();
|
||||
|
|
|
|||
|
|
@ -1810,3 +1810,38 @@ UINT32 I_GetRefreshRate(void)
|
|||
// trouble querying mode over and over again.
|
||||
return refresh_rate;
|
||||
}
|
||||
|
||||
namespace srb2::cvarhandler
|
||||
{
|
||||
void on_set_vid_wait();
|
||||
}
|
||||
|
||||
void srb2::cvarhandler::on_set_vid_wait()
|
||||
{
|
||||
int interval = 0;
|
||||
if (cv_vidwait.value > 0)
|
||||
{
|
||||
interval = 1;
|
||||
}
|
||||
|
||||
switch (rendermode)
|
||||
{
|
||||
case render_soft:
|
||||
if (sdlglcontext == nullptr || SDL_GL_GetCurrentContext() != sdlglcontext)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SDL_GL_SetSwapInterval(interval);
|
||||
break;
|
||||
#ifdef HWRENDER
|
||||
case render_opengl:
|
||||
if (g_legacy_gl_context == nullptr || SDL_GL_GetCurrentContext() != g_legacy_gl_context)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SDL_GL_SetSwapInterval(interval);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue