From 1e3e14ba75f1bc3e231e797aef6a1435fa1a769c Mon Sep 17 00:00:00 2001 From: "iwg..ic" Date: Fri, 13 Sep 2013 16:52:30 +0000 Subject: [PATCH] Update cursorPos for TouchEvents so InputManager.getCursorPosition() returns the last touch location. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10776 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core/com/jme3/input/InputManager.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/engine/src/core/com/jme3/input/InputManager.java b/engine/src/core/com/jme3/input/InputManager.java index 3c5907b70..e05f8ee8f 100644 --- a/engine/src/core/com/jme3/input/InputManager.java +++ b/engine/src/core/com/jme3/input/InputManager.java @@ -324,28 +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 + // 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 + // 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); @@ -918,6 +918,7 @@ public class InputManager implements RawInputListener { if (!eventsPermitted) { throw new UnsupportedOperationException("TouchInput has raised an event at an illegal time."); } + cursorPos.set(evt.getX(), evt.getY()); inputQueue.add(evt); } }