* SDL build no longer requires a vid_restart when changing r_fullscreen

This commit is contained in:
Tim Angus 2006-01-25 17:57:53 +00:00
parent 355fd83d11
commit 947ebb932e
3 changed files with 48 additions and 22 deletions

View file

@ -1043,28 +1043,22 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
}
#ifndef _WIN32
if (key == K_ENTER)
{
if (down)
{
if (keys[K_ALT].down)
{
Key_ClearStates();
if (Cvar_VariableValue("r_fullscreen") == 0)
{
Com_Printf("Switching to fullscreen rendering\n");
Cvar_Set("r_fullscreen", "1");
}
else
{
Com_Printf("Switching to windowed rendering\n");
Cvar_Set("r_fullscreen", "0");
}
Cbuf_ExecuteText( EXEC_APPEND, "vid_restart\n");
return;
}
}
}
if (key == K_ENTER)
{
if (down)
{
if (keys[K_ALT].down)
{
Key_ClearStates();
Cvar_SetValue( "r_fullscreen",
!Cvar_VariableIntegerValue( "r_fullscreen" ) );
#if !USE_SDL_VIDEO // This is handled in sdl_glimp.c/GLimp_EndFrame
Cbuf_ExecuteText( EXEC_APPEND, "vid_restart\n");
#endif
return;
}
}
}
#endif
// console key is hardcoded, so the user can never unbind it

View file

@ -926,7 +926,11 @@ void R_Register( void )
r_overBrightBits = ri.Cvar_Get ("r_overBrightBits", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE | CVAR_LATCH);
r_mode = ri.Cvar_Get( "r_mode", "3", CVAR_ARCHIVE | CVAR_LATCH );
#if USE_SDL_VIDEO
r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE );
#else
r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE | CVAR_LATCH );
#endif
r_customwidth = ri.Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE | CVAR_LATCH );
r_customheight = ri.Cvar_Get( "r_customheight", "1024", CVAR_ARCHIVE | CVAR_LATCH );
r_customaspect = ri.Cvar_Get( "r_customaspect", "1", CVAR_ARCHIVE | CVAR_LATCH );

View file

@ -1040,6 +1040,34 @@ void GLimp_EndFrame (void)
SDL_GL_SwapBuffers();
}
if( r_fullscreen->modified )
{
qboolean fullscreen;
qboolean sdlToggled = qfalse;
SDL_Surface *s = SDL_GetVideoSurface( );
if( s )
{
// Find out the current state
if( s->flags & SDL_FULLSCREEN )
fullscreen = qtrue;
else
fullscreen = qfalse;
// Is the state we want different from the current state?
if( !!r_fullscreen->integer != fullscreen )
sdlToggled = SDL_WM_ToggleFullScreen( s );
else
sdlToggled = qtrue;
}
// SDL_WM_ToggleFullScreen didn't work, so do it the slow way
if( !sdlToggled )
Cbuf_AddText( "vid_restart" );
r_fullscreen->modified = qfalse;
}
// check logging
QGL_EnableLogging( (qboolean)r_logFile->integer ); // bk001205 - was ->value
}