From 6f30ddc41a71343220c7b1d14c31cdad6fbea907 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 28 Sep 2011 17:20:06 +0200 Subject: NEWT/Android: Send MouseClicked event, MouseEvent enhancement, Demo: real 2 finger zoom MouseEvent: Check array sizes at cstr. Enhance 'toString()', pointer arrays added. GPUUISceneGLListener0A now uses 2 finger distance for zoom --- .../jogamp/newt/driver/android/AndroidWindow.java | 43 ++++++++++++---- .../android/event/AndroidNewtEventFactory.java | 59 ++++++++++++++++++++-- 2 files changed, 90 insertions(+), 12 deletions(-) (limited to 'src/newt/classes/jogamp') diff --git a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java index 5ce40a05e..f57dc6d0f 100644 --- a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java +++ b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java @@ -46,6 +46,7 @@ import jogamp.opengl.egl.EGLGraphicsConfiguration; import android.content.Context; import android.graphics.PixelFormat; import android.util.Log; +import android.view.MotionEvent; import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceHolder.Callback2; @@ -80,16 +81,29 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 { return PixelFormat.RGBA_8888; } + class AndroidEvents implements /* View.OnKeyListener, */ View.OnTouchListener { + + public boolean onTouch(View v, MotionEvent event) { + MouseEvent[] newtEvents = AndroidNewtEventFactory.createMouseEvents(AndroidWindow.this, event); + if(null != newtEvents) { + for(int i=0; i> android.view.MotionEvent.ACTION_POINTER_ID_SHIFT); + sb.append(")" ); + } + sb.append("[" ); + for (int i = 0; i < event.getPointerCount(); i++) { + sb.append("#" ).append(i); + sb.append("(pid " ).append(event.getPointerId(i)); + sb.append(")=" ).append((int) event.getX(i)); + sb.append("," ).append((int) event.getY(i)); + if (i + 1 < event.getPointerCount()) + sb.append(";" ); + } + sb.append("]" ); + return sb.toString(); + } } -- cgit v1.2.3