aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorRami Santina <[email protected]>2011-08-02 17:05:04 +0300
committerRami Santina <[email protected]>2011-08-02 17:05:04 +0300
commit0ee0e2a933bdd66d382c2745732a60b32b442877 (patch)
tree5bec9c654e2e0bca9a67c19b4f189cb57644b726 /src/newt
parentecad1c4d31e5f95879914396002437517c97d9dd (diff)
android map motion pressure to newt
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/event/MouseEvent.java27
-rw-r--r--src/newt/classes/com/jogamp/newt/event/android/AndroidNewtEventFactory.java10
2 files changed, 23 insertions, 14 deletions
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
index fe6beceae..7ad7d6e2d 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
@@ -53,11 +53,9 @@ public class MouseEvent extends InputEvent
int rotation)
{
super(eventType, source, when, modifiers);
- this.x = new int[1];
- this.y = new int[1];
-
- this.x[0]=x;
- this.y[0]=y;
+ this.x = new int[]{x};
+ this.y = new int[]{y};
+ this.pressure = new float[]{0};
this.clickCount=clickCount;
this.button=button;
@@ -65,12 +63,13 @@ public class MouseEvent extends InputEvent
}
public MouseEvent(int eventType, Object source, long when,
- int modifiers, int[] x, int[] y, int clickCount, int button,
+ int modifiers, int[] x, int[] y, float[] pressure, int clickCount, int button,
int rotation)
{
super(eventType, source, when, modifiers);
this.x = x;
this.y = y;
+ this.pressure = pressure;
this.clickCount=clickCount;
this.button=button;
@@ -81,10 +80,6 @@ public class MouseEvent extends InputEvent
return x.length;
}
- public int getPointerID() {
- return x.length;
- }
-
public int getButton() {
return button;
}
@@ -94,6 +89,7 @@ public class MouseEvent extends InputEvent
public int getX() {
return x[0];
}
+
public int getY() {
return y[0];
}
@@ -105,7 +101,15 @@ public class MouseEvent extends InputEvent
public int getY(int pointer) {
return y[pointer];
}
-
+
+ public float getPressure(){
+ return pressure[0];
+ }
+
+ public float getPressure(int pointer){
+ return pressure[pointer];
+ }
+
public int getWheelRotation() {
return wheelRotation;
}
@@ -133,6 +137,7 @@ public class MouseEvent extends InputEvent
}
}
private final int x[], y[], clickCount, button, wheelRotation;
+ private final float pressure[];
public static final int EVENT_MOUSE_CLICKED = 200;
public static final int EVENT_MOUSE_ENTERED = 201;
diff --git a/src/newt/classes/com/jogamp/newt/event/android/AndroidNewtEventFactory.java b/src/newt/classes/com/jogamp/newt/event/android/AndroidNewtEventFactory.java
index 59bd1872f..77028c713 100644
--- a/src/newt/classes/com/jogamp/newt/event/android/AndroidNewtEventFactory.java
+++ b/src/newt/classes/com/jogamp/newt/event/android/AndroidNewtEventFactory.java
@@ -137,24 +137,28 @@ class AndroidNewtEventFactory {
int type = eventTypeANDROID2NEWT.get(event.getAction());
if(-1 < type) {
int rotation = 0;
+ int clickCount = 1;
+ int modifiers = 0;
int[] x = new int[event.getPointerCount()];
int[] y = new int[event.getPointerCount()];
+ float[] pressure = new float[event.getPointerCount()];
int index = 0;
while(index < event.getPointerCount()) {
x[index] = (int)event.getX(index);
y[index] = (int)event.getY(index);
+ pressure[index] = event.getPressure(index);
index++;
}
int pointer = androidActionPointer2Newt(event);
return new com.jogamp.newt.event.MouseEvent(
type, (null==newtSource)?null:(Object)newtSource, event.getEventTime(),
- 0 ,
- x, y, 1,
+ modifiers ,
+ x, y, pressure, clickCount,
pointer+1, rotation);
- }
+ }
return null; // no mapping ..
}
}