diff options
Diffstat (limited to 'source/gameengine/GameLogic/SCA_JoystickSensor.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_JoystickSensor.cpp | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp index 7e9a4bc903c..b4e461a9c2b 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp @@ -113,21 +113,21 @@ bool SCA_JoystickSensor::Evaluate() return false; m_reset = false; - switch(m_joymode) - { - case KX_JOYSENSORMODE_AXIS: + + switch (m_joymode) { + case KX_JOYSENSORMODE_AXIS: { - /* what is what! - m_axisf == JOYAXIS_RIGHT, JOYAXIS_UP, JOYAXIS_DOWN, JOYAXIS_LEFT - m_axisf == 1 == up - m_axisf == 2 == left - m_axisf == 3 == down - - numberof== m_axis (1-4), range is half of JOYAXIS_MAX since - it assumes the axis joysticks are axis parirs (0,1), (2,3), etc - also note that this starts at 1 where functions its used - with expect a zero index. - */ + /* what is what! + * m_axisf == JOYAXIS_RIGHT, JOYAXIS_UP, JOYAXIS_DOWN, JOYAXIS_LEFT + * m_axisf == 1 == up + * m_axisf == 2 == left + * m_axisf == 3 == down + * + * numberof== m_axis (1-4), range is half of JOYAXIS_MAX since + * it assumes the axis joysticks are axis parirs (0,1), (2,3), etc + * also note that this starts at 1 where functions its used + * with expect a zero index. + */ if (!js->IsTrigAxis() && !reset) /* No events from SDL? - don't bother */ return false; @@ -159,7 +159,7 @@ bool SCA_JoystickSensor::Evaluate() } break; } - case KX_JOYSENSORMODE_AXIS_SINGLE: + case KX_JOYSENSORMODE_AXIS_SINGLE: { /* Like KX_JOYSENSORMODE_AXIS but don't pair up axis */ if (!js->IsTrigAxis() && !reset) /* No events from SDL? - don't bother */ @@ -179,12 +179,12 @@ bool SCA_JoystickSensor::Evaluate() } break; } - - case KX_JOYSENSORMODE_BUTTON: + + case KX_JOYSENSORMODE_BUTTON: { - /* what is what! - m_button = the actual button in question - */ + /* what is what! + * m_button = the actual button in question + */ if (!js->IsTrigButton() && !reset) /* No events from SDL? - don't bother */ return false; @@ -200,12 +200,12 @@ bool SCA_JoystickSensor::Evaluate() } break; } - case KX_JOYSENSORMODE_HAT: + case KX_JOYSENSORMODE_HAT: { - /* what is what! - numberof = m_hat -- max 4 - direction= m_hatf -- max 12 - */ + /* what is what! + * numberof = m_hat -- max 4 + * direction= m_hatf -- max 12 + */ if (!js->IsTrigHat() && !reset) /* No events from SDL? - don't bother */ return false; @@ -222,18 +222,19 @@ bool SCA_JoystickSensor::Evaluate() } break; } - /* test for ball anyone ?*/ - default: - printf("Error invalid switch statement\n"); - break; + /* test for ball anyone ?*/ + default: + printf("Error invalid switch statement\n"); + break; } - /* if not all events are enabled, only send a positive pulse when + /* if not all events are enabled, only send a positive pulse when * the button state changes */ if (!m_bAllEvents) { if (m_istrig_prev == m_istrig) { result = false; - } else { + } + else { m_istrig_prev = m_istrig; } } @@ -353,7 +354,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_axis_values(void *self_v, const KX_PYAT int axis_index= joy->GetNumberOfAxes(); PyObject *list= PyList_New(axis_index); - while(axis_index--) { + while (axis_index--) { PyList_SET_ITEM(list, axis_index, PyLong_FromSsize_t(joy->GetAxisPosition(axis_index))); } @@ -381,7 +382,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATT int hat_index= joy->GetNumberOfHats(); PyObject *list= PyList_New(hat_index); - while(hat_index--) { + while (hat_index--) { PyList_SET_ITEM(list, hat_index, PyLong_FromSsize_t(joy->GetHat(hat_index))); } |