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/SCA_PythonJoystick.cpp')
-rw-r--r--source/gameengine/GameLogic/SCA_PythonJoystick.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonJoystick.cpp b/source/gameengine/GameLogic/SCA_PythonJoystick.cpp
index 9b24ad7bcf2..06f42e84147 100644
--- a/source/gameengine/GameLogic/SCA_PythonJoystick.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonJoystick.cpp
@@ -125,7 +125,7 @@ PyObject* SCA_PythonJoystick::pyattr_get_num_x(void *self_v, const KX_PYATTRIBUT
PyObject* SCA_PythonJoystick::pyattr_get_active_buttons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_PythonJoystick* self = static_cast<SCA_PythonJoystick*>(self_v);
-
+
const int button_number = self->m_joystick->GetNumberOfButtons();
PyObject *list = PyList_New(0);
@@ -145,25 +145,25 @@ PyObject* SCA_PythonJoystick::pyattr_get_active_buttons(void *self_v, const KX_P
PyObject* SCA_PythonJoystick::pyattr_get_hat_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_PythonJoystick* self = static_cast<SCA_PythonJoystick*>(self_v);
-
+
int hat_index = self->m_joystick->GetNumberOfHats();
PyObject *list = PyList_New(hat_index);
-
+
while (hat_index--) {
PyList_SET_ITEM(list, hat_index, PyLong_FromLong(self->m_joystick->GetHat(hat_index)));
}
-
+
return list;
}
PyObject* SCA_PythonJoystick::pyattr_get_axis_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_PythonJoystick* self = static_cast<SCA_PythonJoystick*>(self_v);
-
+
int axis_index = self->m_joystick->GetNumberOfAxes();
PyObject *list = PyList_New(axis_index);
int position;
-
+
while (axis_index--) {
position = self->m_joystick->GetAxisPosition(axis_index);
@@ -175,7 +175,7 @@ PyObject* SCA_PythonJoystick::pyattr_get_axis_values(void *self_v, const KX_PYAT
else
PyList_SET_ITEM(list, axis_index, PyFloat_FromDouble(position/(double)SHRT_MAX));
}
-
+
return list;
}