Java side makes use of the official multitouch implementation of SDL hedgeroid
authorXeli
Sat, 12 Nov 2011 17:27:23 +0100
branchhedgeroid
changeset 6332 5d9cc2441c48
parent 6330 1bde8940e1bb
child 6334 b05d3af9a58e
Java side makes use of the official multitouch implementation of SDL
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/SDLActivity.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/TouchInterface/TouchInterface.java
--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/SDLActivity.java	Sat Nov 12 17:14:56 2011 +0100
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/SDLActivity.java	Sat Nov 12 17:27:23 2011 +0100
@@ -121,7 +121,7 @@
 
 	public static native void onNativeKeyUp(int keycode);
 
-	public static native void onNativeTouch(int action, int pointer, float x, float y,
+	public static native void onNativeTouch(int touchDevId, int pointerFingerId, int action, float x, float y,
 			float p);
 
 	public static native void onNativeAccel(float x, float y, float z);
--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/TouchInterface/TouchInterface.java	Sat Nov 12 17:14:56 2011 +0100
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/TouchInterface/TouchInterface.java	Sat Nov 12 17:27:23 2011 +0100
@@ -49,16 +49,11 @@
 	public boolean onTouch(View v, MotionEvent event) {
 		//dumpEvent(event);
 		
-		if(firstEvent){
-			firstEvent = false;
-			SDLActivity.onNativeTouch(-1, -1, v.getWidth(), v.getHeight(), 1);
-		}
-		
 		int action = event.getAction();
 		int actionCode = action & MotionEvent.ACTION_MASK;
 		
 		for (int i = 0; i < event.getPointerCount(); i++) {
-			SDLActivity.onNativeTouch(actionCode, event.getPointerId(i), (int)event.getX(i), (int)event.getY(i), event.getPressure(i));
+			SDLActivity.onNativeTouch(event.getDeviceId(),  event.getPointerId(i), actionCode, (int)event.getX(i), (int)event.getY(i), event.getPressure(i));
 //			Log.d("Android", String.format("x=%f, y=%f, pntr=%d", event.getX(i), event.getY(i), event.getPointerId(i)));
 		   }
 		return true;