1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2011-2013 Alexis Laferrière <alexis.laf@xymus.net>
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Defines abstract classes for user and general inputs to the application.
18 # Implemented independantly for each platforms and technologies.
21 # Input to the App, propagated through `App::input`.
25 # Mouse and touch input events
26 interface PointerEvent
29 # X position on screen (in pixels)
30 fun x
: Float is abstract
32 # Y position on screen (in pixels)
33 fun y
: Float is abstract
35 # Is down? either going down or already down
36 fun pressed
: Bool is abstract
37 fun depressed
: Bool is abstract
40 # A motion event on screen composed of many `PointerEvent`
42 # Example of a `MotionEvent` a gesture such as pinching using two fingers.
46 # A pointer just went down?
47 fun just_went_down
: Bool is abstract
49 # Which pointer is down, if any
50 fun down_pointer
: nullable PointerEvent is abstract
53 # Specific touch event
57 # Pressure level of input
58 fun pressure
: Float is abstract
61 # Keyboard or other keys event
65 # Key is currently down?
66 fun is_down
: Bool is abstract
68 # Key is currently up?
69 fun is_up
: Bool is abstract
71 # Key is the up arrow key?
72 fun is_arrow_up
: Bool is abstract
74 # Key is the left arrow key?
75 fun is_arrow_left
: Bool is abstract
77 # Key is the down arrow key?
78 fun is_arrow_down
: Bool is abstract
80 # Key is the right arrow key?
81 fun is_arrow_right
: Bool is abstract
83 # Key code, is plateform specific
84 fun code
: Int is abstract
86 # Get Char value of key, if any
87 fun to_c
: nullable Char is abstract
90 # Mobile hardware (or pseudo hardware) event
91 interface MobileKeyEvent
94 # Key is back button? (mostly for Android)
95 fun is_back_key
: Bool is abstract
97 # Key is menu button? (mostly for Android)
98 fun is_menu_key
: Bool is abstract
100 # Key is search button? (mostly for Android)
101 fun is_search_key
: Bool is abstract
103 # Key is home button? (mostly for Android)
104 fun is_home_key
: Bool is abstract
107 # Sensor events like accelerometer, gyroscope etc for mobile apps
108 interface SensorEvent
112 # Quit event, used for window close button