a_star: don't crash on deserialization errors and limit static types
[nit.git] / lib / android / input_events.nit
index 9597eea..96663c7 100644 (file)
@@ -18,7 +18,7 @@
 module input_events
 
 import mnit::input
-import android
+import android::game
 
 in "C header" `{
        #include <android/log.h>
@@ -70,6 +70,8 @@ private extern class NativeAndroidMotionEvent `{AInputEvent *`}
        `}
 
        fun action: AMotionEventAction `{ return AMotionEvent_getAction(self); `}
+
+       fun native_down_time: Int `{ return AMotionEvent_getDownTime(self); `}
 end
 
 private extern class AMotionEventAction `{ int32_t `}
@@ -149,6 +151,11 @@ class AndroidMotionEvent
                        return null
                end
        end
+
+       # Time when the user originally pressed down to start a stream of position events
+       #
+       # The return value is in the `java.lang.System.nanoTime()` time base.
+       fun down_time: Int do return native.native_down_time
 end
 
 # A pointer event
@@ -193,7 +200,7 @@ class AndroidPointerEvent
                motion_event.just_went_down
 
        # Unique id of this pointer since the beginning of the gesture
-       fun pointer_id: Int do return native_pointer_id(motion_event.native, pointer_index)
+       redef fun pointer_id do return native_pointer_id(motion_event.native, pointer_index)
 
        private fun native_pointer_id(motion_event: NativeAndroidMotionEvent, pointer_index: Int): Int `{
                return AMotionEvent_getPointerId(motion_event, pointer_index);