[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59646] trunk/blender/source/gameengine/ GameLogic/Joystick/SCA_Joystick.cpp: Allowing the BGE to build with SDL2.
Mitchell Stokes
mogurijin at gmail.com
Fri Aug 30 00:48:27 CEST 2013
Revision: 59646
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59646
Author: moguri
Date: 2013-08-29 22:48:27 +0000 (Thu, 29 Aug 2013)
Log Message:
-----------
Allowing the BGE to build with SDL2. I'm not sure if this is the correct fix yet, but at least it builds.
Modified Paths:
--------------
trunk/blender/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
Modified: trunk/blender/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp 2013-08-29 22:10:25 UTC (rev 59645)
+++ trunk/blender/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp 2013-08-29 22:48:27 UTC (rev 59646)
@@ -278,7 +278,11 @@
{
#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 @@
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 @@
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 */
More information about the Bf-blender-cvs
mailing list