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-08 07:16:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2008-10-08 07:16:19 +0400
commitce4162c9a13f8d147e898c625ffe1e10bca3b48d (patch)
treee178b605ed574fe8fcf24532f26ce13e24fe2144 /source/gameengine/GameLogic/SCA_JoystickSensor.cpp
parentb8c294d323551591a1140e3b73e03b996303eb81 (diff)
* Joystick sensor is now only triggered from events of the selected type.
* Keyboard sensor - added (back?) support for qualifiers (Hold buttons in the UI)
Diffstat (limited to 'source/gameengine/GameLogic/SCA_JoystickSensor.cpp')
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickSensor.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
index 2e9db5fb20a..bcd3aa842b7 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
@@ -110,9 +110,6 @@ bool SCA_JoystickSensor::Evaluate(CValue* event)
if(js==NULL) /* no joystick - dont do anything */
return false;
- if (!js->IsTrig()) /* No events from SDL? - dont bother */
- return reset ? true : false;
-
m_reset = false;
switch(m_joymode)
{
@@ -125,6 +122,10 @@ bool SCA_JoystickSensor::Evaluate(CValue* event)
m_axisf == 3 == down
numberof== m_axis -- max 2
*/
+
+ if (!js->IsTrigAxis()) /* No events from SDL? - dont bother */
+ return reset ? true : false;
+
js->cSetPrecision(m_precision);
if (m_bAllEvents) {
if(js->aAnyAxisIsPositive(m_axis)){
@@ -188,6 +189,9 @@ bool SCA_JoystickSensor::Evaluate(CValue* event)
/* what is what!
m_button = the actual button in question
*/
+ if (!js->IsTrigButton()) /* No events from SDL? - dont bother */
+ return reset ? true : false;
+
if(( m_bAllEvents && js->aAnyButtonPressIsPositive()) || (!m_bAllEvents && js->aButtonPressIsPositive(m_button))) {
m_istrig = 1;
result = true;
@@ -205,6 +209,10 @@ bool SCA_JoystickSensor::Evaluate(CValue* event)
numberof = m_hat -- max 2
direction= m_hatf -- max 12
*/
+
+ if (!js->IsTrigHat()) /* No events from SDL? - dont bother */
+ return reset ? true : false;
+
if(m_hat == 1){
if(js->aHatIsPositive(m_hatf)){
m_istrig = 1;
@@ -227,19 +235,6 @@ bool SCA_JoystickSensor::Evaluate(CValue* event)
}
}
}
- /*
- if(m_hat == 3){
- if(js->aHatIsPositive(m_hatf)){
- m_istrig = 1;
- result = true;
- }else{
- if(m_istrig){
- m_istrig = 0;
- result = true;
- }
- }
- }
- */
break;
}
/* test for ball anyone ?*/