diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-05 12:23:30 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-06 12:33:38 +0300 |
commit | f322362363066cd8863938fda33d0667570bb97a (patch) | |
tree | a66a65af109776dbfe3933909d17bccee3a5aef0 | |
parent | b8b7bd0e6a14989f08d91c42efe79c0995537f07 (diff) |
Recent fix for SDL2 broke joysticks for SDL1.2
-rw-r--r-- | source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index e3bc409eb07..daf869e3e61 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -111,7 +111,11 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) char *videodriver = getenv("SDL_VIDEODRIVER"); BLI_setenv("SDL_VIDEODRIVER", "dummy"); +#if SDL_VERSION_ATLEAST(2, 0, 0) int success = (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1 ); +#else + int success = (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) != -1 ); +#endif BLI_setenv("SDL_VIDEODRIVER", videodriver); # endif @@ -156,7 +160,11 @@ void SCA_Joystick::ReleaseInstance() /* The video subsystem is required for joystick input to work. However, * when GHOST is running under SDL, video is freed elsewhere. * Do this once only. */ +#if SDL_VERSION_ATLEAST(2, 0, 0) SDL_QuitSubSystem(SDL_INIT_JOYSTICK); +#else + SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO); +#endif #endif /* WITH_SDL */ } } |