mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Implement r_vsync for the softrenderer.
Whenever the r_vsync cvar is changed recreated the SDL renderer with the appropriate flags.
This commit is contained in:
parent
3df860983f
commit
cf03e755d3
2 changed files with 22 additions and 3 deletions
|
@ -480,6 +480,7 @@ extern cvar_t *r_lerpmodels;
|
|||
extern cvar_t *r_speeds;
|
||||
extern cvar_t *r_lightlevel;
|
||||
extern cvar_t *r_modulate;
|
||||
extern cvar_t *r_vsync;
|
||||
|
||||
extern cvar_t *vid_fullscreen;
|
||||
extern cvar_t *vid_gamma;
|
||||
|
|
|
@ -146,6 +146,7 @@ cvar_t *r_fullbright;
|
|||
cvar_t *r_lerpmodels;
|
||||
cvar_t *r_novis;
|
||||
cvar_t *r_modulate;
|
||||
cvar_t *r_vsync;
|
||||
|
||||
cvar_t *r_speeds;
|
||||
cvar_t *r_lightlevel; //FIXME HACK
|
||||
|
@ -286,6 +287,7 @@ void R_Register (void)
|
|||
r_lerpmodels = ri.Cvar_Get( "r_lerpmodels", "1", 0 );
|
||||
r_novis = ri.Cvar_Get( "r_novis", "0", 0 );
|
||||
r_modulate = ri.Cvar_Get("r_modulate", "1", CVAR_ARCHIVE);
|
||||
r_vsync = ri.Cvar_Get("r_vsync", "1", CVAR_ARCHIVE);
|
||||
|
||||
vid_fullscreen = ri.Cvar_Get( "vid_fullscreen", "0", CVAR_ARCHIVE );
|
||||
vid_gamma = ri.Cvar_Get( "vid_gamma", "1.0", CVAR_ARCHIVE );
|
||||
|
@ -1102,7 +1104,7 @@ void RE_BeginFrame( float camera_separation )
|
|||
sw_overbrightbits->modified = false;
|
||||
}
|
||||
|
||||
while (r_mode->modified || vid_fullscreen->modified)
|
||||
while (r_mode->modified || vid_fullscreen->modified || r_vsync->modified)
|
||||
{
|
||||
rserr_t err;
|
||||
|
||||
|
@ -1117,6 +1119,7 @@ void RE_BeginFrame( float camera_separation )
|
|||
sw_state.prev_mode = r_mode->value;
|
||||
vid_fullscreen->modified = false;
|
||||
r_mode->modified = false;
|
||||
r_vsync->modified = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1363,7 +1366,14 @@ void R_Printf(int level, const char* msg, ...)
|
|||
|
||||
qboolean RE_IsVsyncActive(void)
|
||||
{
|
||||
return true;
|
||||
if (r_vsync->value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1623,7 +1633,15 @@ static qboolean CreateSDLWindow(int flags, int w, int h)
|
|||
// TODO: support fullscreen on different displays with SDL_WINDOWPOS_UNDEFINED_DISPLAY(displaynum)
|
||||
window = SDL_CreateWindow("Yamagi Quake II", windowPos, windowPos, w, h, flags);
|
||||
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||
if (r_vsync->value)
|
||||
{
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
||||
}
|
||||
|
||||
surface = SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask);
|
||||
|
||||
texture = SDL_CreateTexture(renderer,
|
||||
|
|
Loading…
Reference in a new issue