You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Adds Pen support for Android
This commit is contained in:
@@ -94,6 +94,11 @@ public class GodotLib {
|
||||
*/
|
||||
public static native void touch(int what, int pointer, int howmany, int[] arr);
|
||||
|
||||
/**
|
||||
* Forward hover events from the main thread to the GL thread.
|
||||
*/
|
||||
public static native void hover(int type, int x, int y);
|
||||
|
||||
/**
|
||||
* Forward accelerometer sensor events from the main thread to the GL thread.
|
||||
* @see android.hardware.SensorEventListener#onSensorChanged(SensorEvent)
|
||||
|
||||
@@ -188,7 +188,18 @@ public class GodotInputHandler implements InputDeviceListener {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
} else if ((event.getSource() & InputDevice.SOURCE_STYLUS) == InputDevice.SOURCE_STYLUS) {
|
||||
final int x = Math.round(event.getX());
|
||||
final int y = Math.round(event.getY());
|
||||
final int type = event.getAction();
|
||||
queueEvent(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GodotLib.hover(type, x, y);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user