lib/mnit: update doc and style of the `input` module
authorAlexis Laferrière <alexis.laf@xymus.net>
Thu, 10 Dec 2015 22:10:24 +0000 (17:10 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Mon, 14 Dec 2015 16:00:00 +0000 (11:00 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/android/input_events.nit
lib/mnit/input.nit
lib/sdl.nit

index 34c5748..45cc8a1 100644 (file)
@@ -188,8 +188,6 @@ class AndroidPointerEvent
        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
-
        # Does this pointer just began touching the screen?
        fun just_went_down: Bool do return motion_event.acting_pointer == self and
                motion_event.just_went_down
index 3bc2ceb..e200d11 100644 (file)
@@ -1,7 +1,5 @@
 # This file is part of NIT ( http://www.nitlanguage.org ).
 #
-# Copyright 2011-2013 Alexis Laferrière <alexis.laf@xymus.net>
-#
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
@@ -18,6 +16,9 @@
 # Implemented independantly for each platforms and technologies.
 module input
 
+import sdl is conditional(linux)
+import android::input_events is conditional(android)
+
 # Input to the App, propagated through `App::input`.
 interface InputEvent
 end
@@ -34,7 +35,9 @@ interface PointerEvent
 
        # Is down? either going down or already down
        fun pressed: Bool is abstract
-       fun depressed: Bool is abstract
+
+       # Is it not currently pressed down? The opposite of `pressed`.
+       fun depressed: Bool do return not pressed
 
        # Is this a movement event?
        fun is_move: Bool is abstract
index dcf98ba..debe908 100644 (file)
@@ -306,7 +306,6 @@ class SDLMouseButtonEvent
        var button: Int
 
        redef var pressed
-       redef fun depressed do return not pressed
 
        # Is this event raised by the left button?
        fun is_left_button: Bool do return button == 1
@@ -352,7 +351,6 @@ class SDLMouseMotionEvent
        var rel_y: Float
 
        redef var pressed
-       redef fun depressed do return not pressed
 
        redef fun is_move do return true