From 937b8937f086a4f9817fd115e488003e333442af Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Sat, 12 Dec 2015 20:22:48 -0500 Subject: [PATCH] lib/mnit & implementations: move up `is_move` from Android to abstract MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/android/input_events.nit | 3 +-- lib/mnit/input.nit | 3 +++ lib/sdl.nit | 12 +++++------- 3 files changed, 9 insertions(+), 9 deletions(-) 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) -- 1.7.9.5