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:
authorCampbell Barton <ideasman42@gmail.com>2018-06-17 18:01:43 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-17 18:03:10 +0300
commit4be752a93cf37700668c604296f37ea08248f13b (patch)
tree0f838c87eaa6bf289b76f232e6b1571a28a55cba /source/gameengine/GameLogic/Joystick
parent5513da65b24a3ce77b1709acea841475115f3a7a (diff)
Cleanup: trailing space in source/gameengine/
Diffstat (limited to 'source/gameengine/GameLogic/Joystick')
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp26
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_Joystick.h24
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp12
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h2
4 files changed, 32 insertions, 32 deletions
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
index 9f532527a80..369ec4257cf 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
@@ -59,10 +59,10 @@ SCA_Joystick::SCA_Joystick(short int index)
{
for (int i=0; i < JOYAXIS_MAX; i++)
m_axis_array[i] = 0;
-
+
for (int i=0; i < JOYHAT_MAX; i++)
m_hat_array[i] = 0;
-
+
#ifdef WITH_SDL
m_private = new PrivateData();
#endif
@@ -94,7 +94,7 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
return NULL;
}
- if (m_refCount == 0)
+ if (m_refCount == 0)
{
int i;
@@ -124,9 +124,9 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
JOYSTICK_ECHO("Error-Initializing-SDL: " << SDL_GetError());
return NULL;
}
-
+
m_joynum = SDL_NumJoysticks();
-
+
for (i = 0; i < m_joynum; i++) {
m_instance[i] = new SCA_Joystick(i);
m_instance[i]->CreateJoystickDevice();
@@ -189,7 +189,7 @@ bool SCA_Joystick::aAxisPairDirectionIsPositive(int axis, int dir)
res = pGetAxis(axis, 1);
else /* JOYAXIS_LEFT || JOYAXIS_RIGHT */
res = pGetAxis(axis, 0);
-
+
if (dir==JOYAXIS_DOWN || dir==JOYAXIS_RIGHT)
return (res > m_prec) ? true : false;
else /* JOYAXIS_UP || JOYAXIS_LEFT */
@@ -273,7 +273,7 @@ bool SCA_Joystick::CreateJoystickDevice(void)
if (m_joyindex>=m_joynum) {
/* don't print a message, because this is done anyway */
//JOYSTICK_ECHO("Joystick-Error: " << SDL_NumJoysticks() << " avaiable joystick(s)");
-
+
/* Need this so python args can return empty lists */
m_axismax = m_buttonmax = m_hatmax = 0;
return false;
@@ -282,9 +282,9 @@ bool SCA_Joystick::CreateJoystickDevice(void)
m_private->m_joystick = SDL_JoystickOpen(m_joyindex);
SDL_JoystickEventState(SDL_ENABLE);
m_isinit = true;
-
+
JOYSTICK_ECHO("Joystick " << m_joyindex << " initialized");
-
+
/* must run after being initialized */
m_axismax = SDL_JoystickNumAxes(m_private->m_joystick);
m_buttonmax = SDL_JoystickNumButtons(m_private->m_joystick);
@@ -292,12 +292,12 @@ bool SCA_Joystick::CreateJoystickDevice(void)
if (m_axismax > JOYAXIS_MAX) m_axismax = JOYAXIS_MAX; /* very unlikely */
else if (m_axismax < 0) m_axismax = 0;
-
+
if (m_hatmax > JOYHAT_MAX) m_hatmax = JOYHAT_MAX; /* very unlikely */
else if (m_hatmax < 0) m_hatmax = 0;
-
+
if (m_buttonmax < 0) m_buttonmax = 0;
-
+
}
return true;
#endif /* WITH_SDL */
@@ -355,7 +355,7 @@ int SCA_Joystick::pAxisTest(int axisnum)
* than what a short can hold. In other words, abs(MIN_SHORT) > MAX_SHRT. */
int i1 = m_axis_array[(axisnum * 2)];
int i2 = m_axis_array[(axisnum * 2) + 1];
-
+
/* long winded way to do:
* return max_ff(absf(i1), absf(i2))
* ...avoid abs from math.h */
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h b/source/gameengine/GameLogic/Joystick/SCA_Joystick.h
index c9221753d45..98b117b70d1 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h
+++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.h
@@ -68,16 +68,16 @@ class SCA_Joystick
#endif
int m_joyindex;
- /**
+ /**
*support for JOYAXIS_MAX axes (in pairs)
*/
int m_axis_array[JOYAXIS_MAX];
- /**
+ /**
*support for JOYHAT_MAX hats (each is a direction)
*/
int m_hat_array[JOYHAT_MAX];
-
+
/**
* Precision or range of the axes
*/
@@ -86,15 +86,15 @@ class SCA_Joystick
/**
* max # of buttons avail
*/
-
+
int m_axismax;
int m_buttonmax;
int m_hatmax;
-
+
/** is the joystick initialized ?*/
bool m_isinit;
-
+
/** is triggered for each event type */
bool m_istrig_axis;
bool m_istrig_button;
@@ -112,7 +112,7 @@ class SCA_Joystick
#if 0 /* not used yet */
void OnBallMotion(SDL_Event *sdl_event) {}
#endif
-
+
#endif /* WITH_SDL */
/**
* Open the joystick
@@ -142,13 +142,13 @@ class SCA_Joystick
SCA_Joystick(short int index);
~SCA_Joystick();
-
+
public:
static SCA_Joystick *GetInstance(short int joyindex);
static void HandleEvents(void);
void ReleaseInstance();
-
+
/*
*/
@@ -182,11 +182,11 @@ public:
bool IsTrigAxis(void) {
return m_istrig_axis;
}
-
+
bool IsTrigButton(void) {
return m_istrig_button;
}
-
+
bool IsTrigHat(void) {
return m_istrig_hat;
}
@@ -198,7 +198,7 @@ public:
int GetNumberOfAxes(void);
int GetNumberOfButtons(void);
int GetNumberOfHats(void);
-
+
/**
* Test if the joystick is connected
*/
diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
index 1dee1de9de2..b1ce31662ed 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
@@ -41,7 +41,7 @@ void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event)
{
if (sdl_event->jaxis.axis >= JOYAXIS_MAX)
return;
-
+
m_axis_array[sdl_event->jaxis.axis] = sdl_event->jaxis.value;
m_istrig_axis = 1;
}
@@ -68,7 +68,7 @@ void SCA_Joystick::OnButtonDown(SDL_Event* sdl_event)
//if (sdl_event->jbutton.button > m_buttonmax) /* unsigned int so always above 0 */
// return;
// sdl_event->jbutton.button;
-
+
m_istrig_button = 1;
}
@@ -93,17 +93,17 @@ void SCA_Joystick::HandleEvents(void)
if (SCA_Joystick::m_instance[i])
SCA_Joystick::m_instance[i]->OnNothing(&sdl_event);
}
-
+
while (SDL_PollEvent(&sdl_event)) {
/* Note! m_instance[sdl_event.jaxis.which]
* will segfault if over JOYINDEX_MAX, not too nice but what are the chances? */
-
+
/* Note!, with buttons, this wont care which button is pressed,
* only to set 'm_istrig_button', actual pressed buttons are detected by SDL_JoystickGetButton */
-
+
/* Note!, if you manage to press and release a button within 1 logic tick
* it wont work as it should */
-
+
switch (sdl_event.type) {
case SDL_JOYAXISMOTION:
SCA_Joystick::m_instance[sdl_event.jaxis.which]->OnAxisMotion(&sdl_event);
diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h b/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h
index 472a7353190..ab42eb57079 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h
+++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h
@@ -24,7 +24,7 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-
+
/** \file SCA_JoystickPrivate.h
* \ingroup gamelogic
*/