diff options
author | Alex Fraser <alex@phatcore.com> | 2012-01-02 16:35:06 +0400 |
---|---|---|
committer | Alex Fraser <alex@phatcore.com> | 2012-01-02 16:35:06 +0400 |
commit | 15dc3d4609883fc8c9b0b8ea3e3294a1b0940d13 (patch) | |
tree | 2b4659b4f89e022a5810bdd577c1ae8d64d9d9a1 /source | |
parent | c2bb2857506a33ca12c4fbc08eee2ce5e2f73145 (diff) |
Fixes two crashers for games, with GHOST under SDL:
- Fixes SDL fullscreen mode for game engine (blenderplayer). Mode switching (resolution changes) not supported yet though.
- Fixes embedded game engine exit.
See patch tracker [#29748].
Diffstat (limited to 'source')
-rw-r--r-- | source/gameengine/GameLogic/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt index 64c2af9031b..98255bb8b97 100644 --- a/source/gameengine/GameLogic/CMakeLists.txt +++ b/source/gameengine/GameLogic/CMakeLists.txt @@ -132,6 +132,10 @@ if(WITH_SDL) ) add_definitions(-DWITH_SDL) + + if(WITH_GHOST_SDL) + add_definitions(-DWITH_GHOST_SDL) + endif() endif() blender_add_lib(ge_logic "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index 0547d97285d..15aeef242b7 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -88,8 +88,14 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) if (m_refCount == 0) { int i; - // do this once only + // The video subsystem is required for joystick input to work. However, + // when GHOST is running under SDL, video is initialised elsewhere. + // Do this once only. +# ifdef WITH_GHOST_SDL + if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1 ){ +# else if(SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) == -1 ){ +# endif echo("Error-Initializing-SDL: " << SDL_GetError()); return NULL; } @@ -124,7 +130,14 @@ void SCA_Joystick::ReleaseInstance() m_instance[i]= NULL; } + // 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. +# ifdef WITH_GHOST_SDL + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); +# else SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO); +# endif #endif /* WITH_SDL */ } } |