While debugging some mutli-touch code, I noticed that the MOVE event was only firing with the first touch pointer, not the second. While looking through AndroidInput, I think there is a problem with the for loop that goes through the active pointers. Patch file below. @nehon can you look at the attached patch file and see if it is correct and commit it? Thanks.
[java]
This patch file was generated by NetBeans IDE
Following Index: paths are relative to: D:UserspotterecDocumentsjMonkeyProjectsjME3srcandroidcomjme3inputandroid
This patch can be applied using context Tools: Patch action on respective folder.
It uses platform neutral UTF-8 encoding and n newlines.
Above lines and this line are ignored by the patching process.
Index: AndroidInput.java
— AndroidInput.java Base (BASE)
+++ AndroidInput.java Locally Modified (Based On LOCAL)
@@ -264,18 +264,18 @@
// Convert all pointers into events
for (int p = 0; p < event.getPointerCount(); p++) {
-
Vector2f lastPos = lastPositions.get(pointerIndex);<br />
-
Vector2f lastPos = lastPositions.get(p);<br />
if (lastPos == null) {
-
lastPos = new Vector2f(event.getX(pointerIndex), this.getHeight() - event.getY(pointerIndex));<br />
-
lastPositions.put(pointerId, lastPos);<br />
-
lastPos = new Vector2f(event.getX(p), this.getHeight() - event.getY(p));<br />
-
lastPositions.put(event.getPointerId(p), lastPos);<br />
}
touch = getNextFreeTouchEvent();
-
touch.set(Type.MOVE, event.getX(pointerIndex), this.getHeight() - event.getY(pointerIndex), event.getX(pointerIndex) - lastPos.x, this.getHeight() - event.getY(pointerIndex) - lastPos.y);<br />
-
touch.setPointerId(pointerId);<br />
-
touch.set(Type.MOVE, event.getX(p), this.getHeight() - event.getY(p), event.getX(p) - lastPos.x, this.getHeight() - event.getY(p) - lastPos.y);<br />
-
touch.setPointerId(p);<br />
touch.setTime(event.getEventTime());
-
touch.setPressure(event.getPressure(pointerIndex));<br />
-
touch.setPressure(event.getPressure(p));<br />
processEvent(touch);
-
lastPos.set(event.getX(pointerIndex), this.getHeight() - event.getY(pointerIndex));<br />
-
lastPos.set(event.getX(p), this.getHeight() - event.getY(p));<br />
}
bWasHandled = true;
break;
[/java]