project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/SDLActivity.java
branchhedgeroid
changeset 5540 76392a62da2f
parent 5538 dcfa3bf24a2a
child 5597 14b3cdb23c2c
--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/SDLActivity.java	Wed Aug 10 14:55:00 2011 +0200
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/SDLActivity.java	Thu Aug 11 14:56:31 2011 +0200
@@ -8,6 +8,7 @@
 
 import org.hedgewars.mobile.EngineProtocol.EngineProtocolNetwork;
 import org.hedgewars.mobile.EngineProtocol.GameConfig;
+import org.hedgewars.mobile.TouchInterface.TouchInterface;
 
 import android.app.Activity;
 import android.content.Context;
@@ -120,7 +121,7 @@
 
 	public static native void onNativeKeyUp(int keycode);
 
-	public static native void onNativeTouch(int action, float x, float y,
+	public static native void onNativeTouch(int action, int pointer, float x, float y,
 			float p);
 
 	public static native void onNativeAccel(float x, float y, float z);
@@ -295,7 +296,7 @@
  * Because of this, that's where we set up the SDL thread
  */
 class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
-		View.OnKeyListener, View.OnTouchListener, SensorEventListener {
+		View.OnKeyListener, SensorEventListener {
 
 	// This is what SDL runs in. It invokes SDL_main(), eventually
 	private Thread mSDLThread;
@@ -319,7 +320,7 @@
 		setFocusableInTouchMode(true);
 		requestFocus();
 		setOnKeyListener(this);
-		setOnTouchListener(this);
+		setOnTouchListener(TouchInterface.getTouchInterface());
 
 		mSensorManager = (SensorManager) context.getSystemService("sensor");
 
@@ -528,18 +529,6 @@
 		return false;
 	}
 
-	// Touch events
-	public boolean onTouch(View v, MotionEvent event) {
-
-		int action = event.getAction();
-		float x = event.getX();
-		float y = event.getY();
-		float p = event.getPressure();
-		// TODO: Anything else we need to pass?
-		SDLActivity.onNativeTouch(action, x, y, p);
-		return true;
-	}
-
 	// Sensor events
 	public void enableSensor(int sensortype, boolean enabled) {
 		// TODO: This uses getDefaultSensor - what if we have >1 accels?