[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43071] trunk/blender: Fixes two crashers for games, with GHOST under SDL:
Alex Fraser
alex at phatcore.com
Mon Jan 2 13:35:07 CET 2012
Revision: 43071
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43071
Author: z0r
Date: 2012-01-02 12:35:06 +0000 (Mon, 02 Jan 2012)
Log Message:
-----------
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].
Modified Paths:
--------------
trunk/blender/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
trunk/blender/intern/ghost/intern/GHOST_DisplayManagerSDL.h
trunk/blender/source/gameengine/GameLogic/CMakeLists.txt
trunk/blender/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
Modified: trunk/blender/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp 2012-01-02 12:25:14 UTC (rev 43070)
+++ trunk/blender/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp 2012-01-02 12:35:06 UTC (rev 43071)
@@ -36,7 +36,7 @@
}
GHOST_TSuccess
-GHOST_DisplayManagerSDL::getNumDisplays(GHOST_TUns8& numDisplays)
+GHOST_DisplayManagerSDL::getNumDisplays(GHOST_TUns8& numDisplays) const
{
numDisplays= SDL_GetNumVideoDisplays();
return GHOST_kSuccess;
@@ -44,7 +44,7 @@
GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplaySettings(GHOST_TUns8 display,
- GHOST_TInt32& numSettings)
+ GHOST_TInt32& numSettings) const
{
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
numSettings= GHOST_TInt32(1);
@@ -54,7 +54,7 @@
GHOST_TSuccess
GHOST_DisplayManagerSDL::getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
- GHOST_DisplaySetting& setting)
+ GHOST_DisplaySetting& setting) const
{
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
@@ -74,7 +74,7 @@
GHOST_TSuccess
GHOST_DisplayManagerSDL::getCurrentDisplaySetting(GHOST_TUns8 display,
- GHOST_DisplaySetting& setting)
+ GHOST_DisplaySetting& setting) const
{
return getDisplaySetting(display,GHOST_TInt32(0),setting);
}
Modified: trunk/blender/intern/ghost/intern/GHOST_DisplayManagerSDL.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_DisplayManagerSDL.h 2012-01-02 12:25:14 UTC (rev 43070)
+++ trunk/blender/intern/ghost/intern/GHOST_DisplayManagerSDL.h 2012-01-02 12:35:06 UTC (rev 43071)
@@ -46,20 +46,20 @@
GHOST_DisplayManagerSDL(GHOST_SystemSDL *system);
GHOST_TSuccess
- getNumDisplays(GHOST_TUns8& numDisplays);
+ getNumDisplays(GHOST_TUns8& numDisplays) const;
GHOST_TSuccess
getNumDisplaySettings(GHOST_TUns8 display,
- GHOST_TInt32& numSettings);
+ GHOST_TInt32& numSettings) const;
GHOST_TSuccess
getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
- GHOST_DisplaySetting& setting);
+ GHOST_DisplaySetting& setting) const;
GHOST_TSuccess
getCurrentDisplaySetting(GHOST_TUns8 display,
- GHOST_DisplaySetting& setting);
+ GHOST_DisplaySetting& setting) const;
GHOST_TSuccess
setCurrentDisplaySetting(GHOST_TUns8 display,
Modified: trunk/blender/source/gameengine/GameLogic/CMakeLists.txt
===================================================================
--- trunk/blender/source/gameengine/GameLogic/CMakeLists.txt 2012-01-02 12:25:14 UTC (rev 43070)
+++ trunk/blender/source/gameengine/GameLogic/CMakeLists.txt 2012-01-02 12:35:06 UTC (rev 43071)
@@ -132,6 +132,10 @@
)
add_definitions(-DWITH_SDL)
+
+ if(WITH_GHOST_SDL)
+ add_definitions(-DWITH_GHOST_SDL)
+ endif()
endif()
blender_add_lib(ge_logic "${SRC}" "${INC}" "${INC_SYS}")
Modified: trunk/blender/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp 2012-01-02 12:25:14 UTC (rev 43070)
+++ trunk/blender/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp 2012-01-02 12:35:06 UTC (rev 43071)
@@ -88,8 +88,14 @@
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 @@
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 */
}
}
More information about the Bf-blender-cvs
mailing list