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>2009-04-07 10:23:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-04-07 10:23:45 +0400
commit885fa49aa4cd49a552bfe6210e3cb4701c4a5d04 (patch)
treea92028138d51c136190dceaaaf600a58246c823c /source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
parent816a9f3acb47f97d5bf92ae7ae8803e31f4a9f0a (diff)
BGE Joystick Sensor
- Raised limit of 2 axis to 4 axis pairs (4==8 joysticks axis pairs) - Added a new Joystick Sensor type "Single Axis", so you can detect horizontal or vertical movement, rather then just Up/Down/Left/Right - added Python attribute "axisSingle" so you can get the value from the selected axis (rather then getting it out of the axis list) - renamed Py attribute "axisPosition" to "axisValues" (was never in a release) If we need to increase the axis limit again just change JOYAXIS_MAX and the button limits.
Diffstat (limited to 'source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp')
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
index 73ca288861d..8e190060e95 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
@@ -68,7 +68,7 @@ void SCA_Joystick::OnButtonUp(SDL_Event* sdl_event)
void SCA_Joystick::OnButtonDown(SDL_Event* sdl_event)
{
- if(sdl_event->jbutton.button >= 0 || sdl_event->jbutton.button <= m_buttonmax)
+ if(sdl_event->jbutton.button <= m_buttonmax) /* unsigned int so always above 0 */
{
m_istrig_button = 1;
m_buttonnum = sdl_event->jbutton.button;
@@ -111,9 +111,11 @@ void SCA_Joystick::HandleEvents(void)
case SDL_JOYBUTTONDOWN:
SCA_Joystick::m_instance[sdl_event.jbutton.which]->OnButtonDown(&sdl_event);
break;
+#if 0 /* Not used yet */
case SDL_JOYBALLMOTION:
SCA_Joystick::m_instance[sdl_event.jball.which]->OnBallMotion(&sdl_event);
break;
+#endif
default:
printf("SCA_Joystick::HandleEvents, Unknown SDL event, this should not happen\n");
break;