diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2013-08-30 02:48:27 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2013-08-30 02:48:27 +0400 |
commit | f62fabca3d007bed3675a851be7c2cf6ed00b794 (patch) | |
tree | 2ae65a82f092c46aed577dff3aca96fce6d5f3c6 /source/gameengine/GameLogic | |
parent | 16a36f320fe918b72f923a66dfb93b7b8e4a9dfd (diff) |
Allowing the BGE to build with SDL2. I'm not sure if this is the correct fix yet, but at least it builds.
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r-- | source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index 8e729ffd7ae..64ab0af4d26 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -278,7 +278,11 @@ void SCA_Joystick::DestroyJoystickDevice(void) { #ifdef WITH_SDL if (m_isinit) { +#if SDL_VERSION_ATLEAST(2, 0, 0) + if (SDL_JoystickGetAttached(m_private->m_joystick)) { +#else if (SDL_JoystickOpened(m_joyindex)) { +#endif JOYSTICK_ECHO("Closing-joystick " << m_joyindex); SDL_JoystickClose(m_private->m_joystick); } @@ -290,7 +294,12 @@ void SCA_Joystick::DestroyJoystickDevice(void) int SCA_Joystick::Connected(void) { #ifdef WITH_SDL - if (m_isinit && SDL_JoystickOpened(m_joyindex)) + if (m_isinit +#if SDL_VERSION_ATLEAST(2, 0, 0) + && SDL_JoystickGetAttached(m_private->m_joystick)) +#else + && SDL_JoystickOpened(m_joyindex)) +#endif return 1; #endif return 0; @@ -328,7 +337,11 @@ int SCA_Joystick::pAxisTest(int axisnum) const char *SCA_Joystick::GetName() { #ifdef WITH_SDL +#if SDL_VERSION_ATLEAST(2, 0, 0) + return SDL_JoystickName(m_private->m_joystick); +#else return SDL_JoystickName(m_joyindex); +#endif #else /* WITH_SDL */ return ""; #endif /* WITH_SDL */ |