From: Alexis Laferrière Date: Sun, 13 Dec 2015 01:22:48 +0000 (-0500) Subject: lib/mnit & implementations: move up `is_move` from Android to abstract X-Git-Tag: v0.8~36^2~18 X-Git-Url: http://nitlanguage.org lib/mnit & implementations: move up `is_move` from Android to abstract Signed-off-by: Alexis Laferrière --- diff --git a/lib/android/input_events.nit b/lib/android/input_events.nit index c1709ae..34c5748 100644 --- a/lib/android/input_events.nit +++ b/lib/android/input_events.nit @@ -185,8 +185,7 @@ class AndroidPointerEvent return action.is_down or action.is_move or action.is_pointer_down end - # Is this a move event? - fun is_move: Bool do return motion_event.acting_pointer == self and + redef fun is_move do return motion_event.acting_pointer == self and motion_event.native.action.is_move redef fun depressed do return not pressed diff --git a/lib/mnit/input.nit b/lib/mnit/input.nit index dca8107..3bc2ceb 100644 --- a/lib/mnit/input.nit +++ b/lib/mnit/input.nit @@ -35,6 +35,9 @@ interface PointerEvent # Is down? either going down or already down fun pressed: Bool is abstract fun depressed: Bool is abstract + + # Is this a movement event? + fun is_move: Bool is abstract end # A motion event on screen composed of many `PointerEvent` diff --git a/lib/sdl.nit b/lib/sdl.nit index 3bbabb5..dcf98ba 100644 --- a/lib/sdl.nit +++ b/lib/sdl.nit @@ -293,14 +293,10 @@ class SDLMouseEvent super PointerEvent super SDLInputEvent - redef var x: Float - redef var y: Float + redef var x + redef var y - private init (x, y: Float) - do - self.x = x - self.y = y - end + redef fun is_move do return false end # MouseButtonEvent used to get information when a button is pressed/depressed @@ -358,6 +354,8 @@ class SDLMouseMotionEvent redef var pressed redef fun depressed do return not pressed + redef fun is_move do return true + init (x, y, rel_x, rel_y: Float, pressed: Bool) do super(x, y)