* Always show the mouse cursor when the mouse is disabled

* Rename IN_StartupJoystick to IN_InitJoystick, add IN_ShutdownJoystick
* Add IN_Restart, which avoids calling IN_DeactivateMouse at the wrong time
* Call IN_Restart when changing r_fullscreen
* Add CVAR_ROM r_sdlDriver for easy checking of the SDL driver in use
* Random README tweaks
This commit is contained in:
Tim Angus 2008-08-09 13:20:00 +00:00
parent d4d5527a89
commit c29417b42a
5 changed files with 58 additions and 21 deletions

View file

@ -323,7 +323,15 @@ IN_DeactivateMouse
*/
static void IN_DeactivateMouse( void )
{
if (!mouseAvailable || !SDL_WasInit( SDL_INIT_VIDEO ) )
if( !SDL_WasInit( SDL_INIT_VIDEO ) )
return;
// Always show the cursor when the mouse is disabled,
// but not when fullscreen
if( !r_fullscreen->integer )
SDL_ShowCursor( 1 );
if( !mouseAvailable )
return;
#ifdef MACOS_X_ACCELERATION_HACK
@ -349,7 +357,6 @@ static void IN_DeactivateMouse( void )
{
SDL_WM_GrabInput( SDL_GRAB_OFF );
SDL_WarpMouse( glConfig.vidWidth / 2, glConfig.vidHeight / 2 );
SDL_ShowCursor( 1 );
mouseActive = qfalse;
}
@ -398,10 +405,10 @@ struct
/*
===============
IN_StartupJoystick
IN_InitJoystick
===============
*/
static void IN_StartupJoystick( void )
static void IN_InitJoystick( void )
{
int i = 0;
int total = 0;
@ -452,8 +459,22 @@ static void IN_StartupJoystick( void )
Com_DPrintf( "Balls: %d\n", SDL_JoystickNumBalls(stick) );
SDL_JoystickEventState(SDL_QUERY);
}
return;
/*
===============
IN_ShutdownJoystick
===============
*/
static void IN_ShutdownJoystick( void )
{
if (stick)
{
SDL_JoystickClose(stick);
stick = NULL;
}
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
}
/*
@ -773,18 +794,22 @@ void IN_Init(void)
in_disablemacosxmouseaccel = Cvar_Get ("in_disablemacosxmouseaccel", "1", CVAR_ARCHIVE);
#endif
Cvar_Set( "cl_platformSensitivity", "1.0" );
SDL_EnableUNICODE(1);
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
keyRepeatEnabled = qtrue;
if (in_mouse->value)
if( in_mouse->value )
{
mouseAvailable = qtrue;
IN_ActivateMouse( );
}
else
{
IN_DeactivateMouse( );
mouseAvailable = qfalse;
}
IN_StartupJoystick( );
IN_InitJoystick( );
Com_DPrintf ("------------------------------------\n");
}
@ -793,17 +818,21 @@ void IN_Init(void)
IN_Shutdown
===============
*/
void IN_Shutdown(void)
void IN_Shutdown( void )
{
IN_DeactivateMouse();
IN_DeactivateMouse( );
mouseAvailable = qfalse;
if (stick)
{
SDL_JoystickClose(stick);
stick = NULL;
}
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
IN_ShutdownJoystick( );
}
/*
===============
IN_Restart
===============
*/
void IN_Restart( void )
{
IN_ShutdownJoystick( );
IN_Init( );
}