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>2008-10-07 09:09:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2008-10-07 09:09:24 +0400
commit77484d28d5098de2fd3924df28d846023d7751ec (patch)
tree3ea8a3660c8e9bb18f0421f6d95c0a604fd710c1 /source/gameengine/GameLogic/SCA_JoystickSensor.h
parent8d73ea72a75ce5567fc2a39f2acc2ad5b2543f4c (diff)
joystick update
* use SDL events to trigger the sensor, trigger was being forced every tick. removed workaround for this problem. * added "All Events" option, similar to all keys in the keyboard sensor. This means every event from the joystick will trigger the sensor, however only events from the selected type (axis/button/hat) is used to set the positive state of the sensor. * Added python function sens_joy.GetButtonValues(), returns a list of pressed button indicies. * Removed pressed/released option for joystick buttons, it was the same as the invert option.
Diffstat (limited to 'source/gameengine/GameLogic/SCA_JoystickSensor.h')
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickSensor.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.h b/source/gameengine/GameLogic/SCA_JoystickSensor.h
index 8b74f6e0296..d316ad1119c 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.h
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.h
@@ -73,7 +73,7 @@ class SCA_JoystickSensor :public SCA_ISensor
* Otherwise it will trigger all the time
* this is used to see if the trigger state changes.
*/
- bool m_istrig_lastjs;
+ bool m_istrig_prev;
/**
* The mode to determine axis,button or hat
*/
@@ -83,6 +83,11 @@ class SCA_JoystickSensor :public SCA_ISensor
*/
short int m_joyindex;
+ /**
+ * Detect all events for the currently selected type
+ */
+ bool m_bAllEvents;
+
enum KX_JOYSENSORMODE {
KX_JOYSENSORMODE_NODEF = 0,
KX_JOYSENSORMODE_AXIS,
@@ -98,8 +103,8 @@ public:
short int joyindex,
short int joymode,
int axis, int axisf,int prec,
- int button, int buttonf,
- int hat, int hatf,
+ int button,
+ int hat, int hatf, bool allevents,
PyTypeObject* T=&Type );
virtual ~SCA_JoystickSensor();
virtual CValue* GetReplica();
@@ -124,12 +129,13 @@ public:
/* Axes*/
KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetAxis);
KX_PYMETHOD_DOC_VARARGS(SCA_JoystickSensor,SetAxis);
- KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetRealAxis);
+ KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetAxisValue);
KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetThreshold);
KX_PYMETHOD_DOC_VARARGS(SCA_JoystickSensor,SetThreshold);
/* Buttons */
KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetButton);
- KX_PYMETHOD_DOC_VARARGS(SCA_JoystickSensor,SetButton);
+ KX_PYMETHOD_DOC_O(SCA_JoystickSensor,SetButton);
+ KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetButtonValue);
/* Hats */
KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetHat);
KX_PYMETHOD_DOC_VARARGS(SCA_JoystickSensor,SetHat);