Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp')
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
index 0547d97285d..48ba09e67d2 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
@@ -29,8 +29,8 @@
* \ingroup gamelogic
*/
-#ifdef WITH_SDL
-# include <SDL.h>
+#ifndef DISABLE_SDL
+#include <SDL.h>
#endif
#include <stdio.h>
@@ -57,7 +57,7 @@ SCA_Joystick::SCA_Joystick(short int index)
for(int i=0; i<JOYHAT_MAX; i++)
m_hat_array[i]= 0;
-#ifdef WITH_SDL
+#ifndef DISABLE_SDL
m_private = new PrivateData();
#endif
}
@@ -66,7 +66,7 @@ SCA_Joystick::SCA_Joystick(short int index)
SCA_Joystick::~SCA_Joystick()
{
-#ifdef WITH_SDL
+#ifndef DISABLE_SDL
delete m_private;
#endif
}
@@ -77,9 +77,9 @@ int SCA_Joystick::m_refCount = 0;
SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
{
-#ifndef WITH_SDL
+#ifdef DISABLE_SDL
return NULL;
-#else /* WITH_SDL */
+#else
if (joyindex < 0 || joyindex >= JOYINDEX_MAX) {
echo("Error-invalid joystick index: " << joyindex);
return NULL;
@@ -107,14 +107,14 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
m_refCount++;
}
return m_instance[joyindex];
-#endif /* WITH_SDL */
+#endif
}
void SCA_Joystick::ReleaseInstance()
{
if (--m_refCount == 0)
{
-#ifdef WITH_SDL
+#ifndef DISABLE_SDL
int i;
for (i=0; i<JOYINDEX_MAX; i++) {
if (m_instance[i]) {
@@ -125,7 +125,7 @@ void SCA_Joystick::ReleaseInstance()
}
SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);
-#endif /* WITH_SDL */
+#endif
}
}
@@ -163,7 +163,7 @@ bool SCA_Joystick::aAxisIsPositive(int axis_single)
bool SCA_Joystick::aAnyButtonPressIsPositive(void)
{
-#ifdef WITH_SDL
+#ifndef DISABLE_SDL
/* this is needed for the "all events" option
* so we know if there are no buttons pressed */
for (int i=0; i<m_buttonmax; i++)
@@ -175,7 +175,7 @@ bool SCA_Joystick::aAnyButtonPressIsPositive(void)
bool SCA_Joystick::aButtonPressIsPositive(int button)
{
-#ifndef WITH_SDL
+#ifdef DISABLE_SDL
return false;
#else
bool result;
@@ -187,7 +187,7 @@ bool SCA_Joystick::aButtonPressIsPositive(int button)
bool SCA_Joystick::aButtonReleaseIsPositive(int button)
{
-#ifndef WITH_SDL
+#ifdef DISABLE_SDL
return false;
#else
bool result;
@@ -221,11 +221,11 @@ int SCA_Joystick::GetNumberOfHats()
bool SCA_Joystick::CreateJoystickDevice(void)
{
-#ifndef WITH_SDL
+#ifdef DISABLE_SDL
m_isinit = true;
m_axismax = m_buttonmax = m_hatmax = 0;
return false;
-#else /* WITH_SDL */
+#else
if(m_isinit == false){
if (m_joyindex>=m_joynum) {
// don't print a message, because this is done anyway
@@ -257,13 +257,13 @@ bool SCA_Joystick::CreateJoystickDevice(void)
}
return true;
-#endif /* WITH_SDL */
+#endif
}
void SCA_Joystick::DestroyJoystickDevice(void)
{
-#ifdef WITH_SDL
+#ifndef DISABLE_SDL
if (m_isinit){
if(SDL_JoystickOpened(m_joyindex)){
echo("Closing-joystick " << m_joyindex);
@@ -271,12 +271,12 @@ void SCA_Joystick::DestroyJoystickDevice(void)
}
m_isinit = false;
}
-#endif /* WITH_SDL */
+#endif
}
int SCA_Joystick::Connected(void)
{
-#ifdef WITH_SDL
+#ifndef DISABLE_SDL
if (m_isinit && SDL_JoystickOpened(m_joyindex))
return 1;
#endif
@@ -285,7 +285,7 @@ int SCA_Joystick::Connected(void)
int SCA_Joystick::pGetAxis(int axisnum, int udlr)
{
-#ifdef WITH_SDL
+#ifndef DISABLE_SDL
return m_axis_array[(axisnum*2)+udlr];
#endif
return 0;
@@ -293,7 +293,7 @@ int SCA_Joystick::pGetAxis(int axisnum, int udlr)
int SCA_Joystick::pAxisTest(int axisnum)
{
-#ifdef WITH_SDL
+#ifndef DISABLE_SDL
short i1= m_axis_array[(axisnum*2)];
short i2= m_axis_array[(axisnum*2)+1];
@@ -304,7 +304,7 @@ int SCA_Joystick::pAxisTest(int axisnum)
if (i2 < 0) i2 = -i2;
if (i1 <i2) return i2;
else return i1;
-#else /* WITH_SDL */
+#else
return 0;
-#endif /* WITH_SDL */
+#endif
}