Disable joystick on non-android by default

This commit is contained in:
def 2014-08-17 16:33:43 +02:00
parent 038129f9ce
commit 5b058b9941
2 changed files with 22 additions and 11 deletions

View file

@ -313,5 +313,10 @@ MACRO_CONFIG_INT(ClAutoUpdate, cl_auto_update, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLI
MACRO_CONFIG_INT(ClOldGunPosition, cl_old_gun_position, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Tees hold gun a bit higher like in TW 0.6.1 and older")
MACRO_CONFIG_INT(ClConfirmDisconnect, cl_confirm_disconnect, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Confirmation popup before disconnecting")
MACRO_CONFIG_STR(ClTimeoutCode, cl_timeout_code, 64, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Timeout code to use")
#if defined(__ANDROID__)
MACRO_CONFIG_INT(InpJoystick, inp_joystick, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Try to use a joystick as input")
#else
MACRO_CONFIG_INT(InpJoystick, inp_joystick, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Try to use a joystick as input")
#endif
#endif

View file

@ -28,6 +28,8 @@ CControls::CControls()
m_LastDummy = 0;
m_OtherFire = 0;
if (g_Config.m_InpJoystick)
{
SDL_Init(SDL_INIT_JOYSTICK);
m_Joystick = SDL_JoystickOpen(0);
if( m_Joystick && SDL_JoystickNumAxes(m_Joystick) < NUM_JOYSTICK_AXES )
@ -46,6 +48,10 @@ CControls::CControls()
m_UsingGamepad = true;
#endif
}
else
m_Joystick = NULL;
m_UsingGamepad = false;
}
void CControls::OnReset()
{