Added code to reset the actions of opposite joystick

axes during analog processing.  Actions were always
invoked for the active axis direction but if the
stick flipped to fast across the middle then the
reverse axis' actions were still "pressed" and would
get stuck.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9779 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
PSp..om 2012-09-26 06:05:24 +00:00
parent 211b63be84
commit 33968b4c39

View File

@ -324,12 +324,28 @@ public class InputManager implements RawInputListener {
} else if (value < 0) {
int hash = JoyAxisTrigger.joyAxisHash(joyId, axis, true);
int otherHash = JoyAxisTrigger.joyAxisHash(joyId, axis, false);
// Clear the reverse direction's actions in case we
// crossed center too quickly
Float otherVal = axisValues.get(otherHash);
if (otherVal != null && otherVal.floatValue() > axisDeadZone) {
invokeActions(otherHash, false);
}
invokeAnalogsAndActions(hash, -value, true);
axisValues.put(hash, -value);
axisValues.remove(otherHash);
} else {
int hash = JoyAxisTrigger.joyAxisHash(joyId, axis, false);
int otherHash = JoyAxisTrigger.joyAxisHash(joyId, axis, true);
// Clear the reverse direction's actions in case we
// crossed center too quickly
Float otherVal = axisValues.get(otherHash);
if (otherVal != null && otherVal.floatValue() > axisDeadZone) {
invokeActions(otherHash, false);
}
invokeAnalogsAndActions(hash, value, true);
axisValues.put(hash, value);
axisValues.remove(otherHash);