1 # This file is part of NIT (http://www.nitlanguage.org).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # Support for gamepad events (over Bluetooth or USB)
20 redef class AndroidKeyEvent
22 # Was `self` raised by the A button?
23 fun is_a
: Bool do return key_code
== 96
25 # Was `self` raised by the B button?
26 fun is_b
: Bool do return key_code
== 97
28 # Was `self` raised by the X button?
29 fun is_x
: Bool do return key_code
== 99
31 # Was `self` raised by the Y button?
32 fun is_y
: Bool do return key_code
== 100
34 # Was `self` raised by the directional pad?
37 return is_dpad_up
or is_dpad_down
or is_dpad_left
or is_dpad_right
40 # Was `self` raised by the up key on the directional pad?
41 fun is_dpad_up
: Bool do return key_code
== 19
43 # Was `self` raised by the down key on the directional pad?
44 fun is_dpad_down
: Bool do return key_code
== 20
46 # Was `self` raised by the left key on the directional pad?
47 fun is_dpad_left
: Bool do return key_code
== 21
49 # Was `self` raised by the right key on the directional pad?
50 fun is_dpad_right
: Bool do return key_code
== 22
52 # Was `self` raised by the start button?
53 fun is_start
: Bool do return key_code
== 108
55 # Was `self` raised by the select button?
56 fun is_select
: Bool do return key_code
== 109
58 # Was `self` raised by the right bumper button?
59 fun is_bumper_right
: Bool do return key_code
== 103
61 # Was `self` raised by the right trigger?
62 fun is_trigger_right
: Bool do return key_code
== 105
64 # Was `self` raised by the left bumper?
65 fun is_bumper_left
: Bool do return key_code
== 102
67 # Was `self` raised by the left trigger?
68 fun is_trigger_left
: Bool do return key_code
== 101
70 # Was `self` raised by the media button 'previous'?
71 fun is_media_previous
: Bool do return key_code
== 87
73 # Was `self` raised by the media button 'pause'?
74 fun is_media_pause
: Bool do return key_code
== 85
76 # Was `self` raised by the media button 'next'?
77 fun is_media_next
: Bool do return key_code
== 88