diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-05 12:23:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-05 12:23:30 +0300 |
commit | 1ef33968fdc72b58c34ba392aaf0499d9d4a97d4 (patch) | |
tree | 942a7538e2644607a56a05109caa56b11595a000 | |
parent | e5063b0bd3e499698a4016a7ff063bea4b667c34 (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 */ } } |