diff options
Diffstat (limited to 'source/gameengine/GameLogic/Joystick')
-rw-r--r-- | source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp | 16 | ||||
-rw-r--r-- | source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index b22246014bf..38416a340c7 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -51,10 +51,10 @@ SCA_Joystick::SCA_Joystick(short int index) m_istrig_button(0), m_istrig_hat(0) { - for(int i=0; i<JOYAXIS_MAX; i++) + for (int i=0; i<JOYAXIS_MAX; i++) m_axis_array[i]= 0; - for(int i=0; i<JOYHAT_MAX; i++) + for (int i=0; i<JOYHAT_MAX; i++) m_hat_array[i]= 0; #ifdef WITH_SDL @@ -92,9 +92,9 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) // when GHOST is running under SDL, video is initialized elsewhere. // Do this once only. # ifdef WITH_GHOST_SDL - if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1 ){ + if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1 ){ # else - if(SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) == -1 ){ + if (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) == -1 ){ # endif echo("Error-Initializing-SDL: " << SDL_GetError()); return NULL; @@ -239,7 +239,7 @@ bool SCA_Joystick::CreateJoystickDevice(void) m_axismax = m_buttonmax = m_hatmax = 0; return false; #else /* WITH_SDL */ - if(m_isinit == false){ + if (m_isinit == false){ if (m_joyindex>=m_joynum) { // don't print a message, because this is done anyway //echo("Joystick-Error: " << SDL_NumJoysticks() << " avaiable joystick(s)"); @@ -264,9 +264,9 @@ bool SCA_Joystick::CreateJoystickDevice(void) 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; + else if (m_hatmax<0) m_hatmax= 0; - if(m_buttonmax<0) m_buttonmax= 0; + if (m_buttonmax<0) m_buttonmax= 0; } return true; @@ -278,7 +278,7 @@ void SCA_Joystick::DestroyJoystickDevice(void) { #ifdef WITH_SDL if (m_isinit){ - if(SDL_JoystickOpened(m_joyindex)){ + if (SDL_JoystickOpened(m_joyindex)){ echo("Closing-joystick " << m_joyindex); SDL_JoystickClose(m_private->m_joystick); } diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp index e1ab364ae67..44b6cfd7d35 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp @@ -40,7 +40,7 @@ #ifdef WITH_SDL void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event) { - if(sdl_event->jaxis.axis >= JOYAXIS_MAX) + if (sdl_event->jaxis.axis >= JOYAXIS_MAX) return; m_axis_array[sdl_event->jaxis.axis]= sdl_event->jaxis.value; @@ -50,7 +50,7 @@ void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event) /* See notes below in the event loop */ void SCA_Joystick::OnHatMotion(SDL_Event* sdl_event) { - if(sdl_event->jhat.hat >= JOYHAT_MAX) + if (sdl_event->jhat.hat >= JOYHAT_MAX) return; m_hat_array[sdl_event->jhat.hat]= sdl_event->jhat.value; @@ -85,7 +85,7 @@ void SCA_Joystick::HandleEvents(void) int i; for (i=0; i<m_joynum; i++) { /* could use JOYINDEX_MAX but no reason to */ - if(SCA_Joystick::m_instance[i]) + if (SCA_Joystick::m_instance[i]) SCA_Joystick::m_instance[i]->OnNothing(&sdl_event); } |