mirror of
https://github.com/ioquake/ioq3.git
synced 2025-06-02 01:42:12 +00:00
avoid setting cvars by name each frame
This commit is contained in:
parent
9b1a3387cb
commit
6f9b34ef75
5 changed files with 22 additions and 13 deletions
|
@ -917,6 +917,14 @@ static void IN_ProcessEvents( void )
|
|||
vidRestartTime = Sys_Milliseconds() + 1000;
|
||||
}
|
||||
break;
|
||||
case SDL_ACTIVEEVENT:
|
||||
if (e.active.state & SDL_APPINPUTFOCUS) {
|
||||
Cvar_SetValue( "com_unfocused", !e.active.gain);
|
||||
}
|
||||
if (e.active.state & SDL_APPACTIVE) {
|
||||
Cvar_SetValue( "com_minimized", !e.active.gain);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -972,6 +980,8 @@ IN_Init
|
|||
*/
|
||||
void IN_Init( void )
|
||||
{
|
||||
int appState;
|
||||
|
||||
if( !SDL_WasInit( SDL_INIT_VIDEO ) )
|
||||
{
|
||||
Com_Error( ERR_FATAL, "IN_Init called before SDL_Init( SDL_INIT_VIDEO )\n" );
|
||||
|
@ -1009,6 +1019,10 @@ void IN_Init( void )
|
|||
mouseAvailable = qfalse;
|
||||
}
|
||||
|
||||
appState = SDL_GetAppState( );
|
||||
Cvar_SetValue( "com_unfocused", !( appState & SDL_APPINPUTFOCUS ) );
|
||||
Cvar_SetValue( "com_minimized", !( appState & SDL_APPACTIVE ) );
|
||||
|
||||
IN_InitJoystick( );
|
||||
Com_DPrintf( "------------------------------------\n" );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue