* Add Sys_GLimpInit for platform specific GLimp initialisation

* Move Unix specific signal handlers to Sys_PlatformInit
* (Windows only) Don't set the SDL video driver if SDL_VIDEODRIVER is already
  set externally
* (Windows only) Use the "windib" SDL video driver if in_mouse is set to -1
This commit is contained in:
Tim Angus 2008-08-08 21:35:33 +00:00
parent 2cf5052786
commit d4d5527a89
5 changed files with 67 additions and 16 deletions

View file

@ -577,6 +577,40 @@ void Sys_ErrorDialog( const char *error )
}
}
#ifndef DEDICATED
static qboolean SDL_VIDEODRIVER_externallySet = qfalse;
#endif
/*
==============
Sys_GLimpInit
Windows specific GL implementation initialisation
==============
*/
void Sys_GLimpInit( void )
{
#ifndef DEDICATED
if( !SDL_VIDEODRIVER_externallySet )
{
// It's a little bit weird having in_mouse control the
// video driver, but from ioq3's point of view they're
// virtually the same except for the mouse input anyway
if( Cvar_VariableIntegerValue( "in_mouse" ) == -1 )
{
// Use the windib SDL backend, which is closest to
// the behaviour of idq3 with in_mouse set to -1
_putenv( "SDL_VIDEODRIVER=windib" );
}
else
{
// Use the DirectX SDL backend
_putenv( "SDL_VIDEODRIVER=directx" );
}
}
#endif
}
/*
==============
Sys_PlatformInit
@ -587,7 +621,15 @@ Windows specific initialisation
void Sys_PlatformInit( void )
{
#ifndef DEDICATED
// Force the DirectX SDL backend to be used
_putenv( "SDL_VIDEODRIVER=directx" );
const char *SDL_VIDEODRIVER = getenv( "SDL_VIDEODRIVER" );
if( SDL_VIDEODRIVER )
{
Com_Printf( "SDL_VIDEODRIVER is externally set to \"%s\", "
"in_mouse -1 will have no effect\n", SDL_VIDEODRIVER );
SDL_VIDEODRIVER_externallySet = qtrue;
}
else
SDL_VIDEODRIVER_externallySet = qfalse;
#endif
}