ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

backends/platform/android/events.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef ANDROID_EVENTS_H
00024 #define ANDROID_EVENTS_H
00025 
00026 #include "common/events.h"
00027 
00028 class KeyReceiver {
00029 public:
00030     enum KeyPressType { DOWN, UP, PRESS };
00031     virtual void keyPress(const Common::KeyCode code, const KeyPressType type = PRESS) = 0;
00032     virtual ~KeyReceiver() {};
00033 };
00034 
00035 // $ANDROID_NDK/platforms/android-9/arch-arm/usr/include/android/keycodes.h
00036 // http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=libs/ui/Input.cpp
00037 // http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/view/KeyEvent.java
00038 
00039 // event type
00040 enum {
00041     JE_SYS_KEY = 0,
00042     JE_KEY = 1,
00043     JE_DPAD = 2,
00044     JE_DOWN = 3,
00045     JE_SCROLL = 4,
00046     JE_TAP = 5,
00047     JE_DOUBLE_TAP = 6,
00048     JE_MULTI = 7,
00049     JE_BALL = 8,
00050     JE_TOUCH = 9,
00051     JE_LONG = 10,
00052     JE_FLING = 11,
00053     JE_QUIT = 0x1000
00054 };
00055 
00056 // action type
00057 enum {
00058     JACTION_DOWN = 0,
00059     JACTION_UP = 1,
00060     JACTION_MOVE = 2,
00061     JACTION_POINTER_DOWN = 5,
00062     JACTION_POINTER_UP = 6
00063 };
00064 
00065 // system keys
00066 enum {
00067     JKEYCODE_SOFT_RIGHT = 2,
00068     JKEYCODE_HOME = 3,
00069     JKEYCODE_BACK = 4,
00070     JKEYCODE_CALL = 5,
00071     JKEYCODE_ENDCALL = 6,
00072     JKEYCODE_VOLUME_UP = 24,
00073     JKEYCODE_VOLUME_DOWN = 25,
00074     JKEYCODE_POWER = 26,
00075     JKEYCODE_CAMERA = 27,
00076     JKEYCODE_HEADSETHOOK = 79,
00077     JKEYCODE_FOCUS = 80,
00078     JKEYCODE_MENU = 82,
00079     JKEYCODE_SEARCH = 84,
00080     JKEYCODE_MUTE = 91,
00081     JKEYCODE_MEDIA_PLAY_PAUSE = 85,
00082     JKEYCODE_MEDIA_STOP = 86,
00083     JKEYCODE_MEDIA_NEXT = 87,
00084     JKEYCODE_MEDIA_PREVIOUS = 88,
00085     JKEYCODE_MEDIA_REWIND = 89,
00086     JKEYCODE_MEDIA_FAST_FORWARD = 90
00087 };
00088 
00089 // five-way navigation control
00090 enum {
00091     JKEYCODE_DPAD_UP = 19,
00092     JKEYCODE_DPAD_DOWN = 20,
00093     JKEYCODE_DPAD_LEFT = 21,
00094     JKEYCODE_DPAD_RIGHT = 22,
00095     JKEYCODE_DPAD_CENTER = 23
00096 };
00097 
00098 // meta modifier
00099 enum {
00100     JMETA_SHIFT = 0x01,
00101     JMETA_ALT = 0x02,
00102     JMETA_SYM = 0x04,
00103     JMETA_CTRL = 0x1000
00104 };
00105 
00106 // map android key codes to our kbd codes
00107 static const Common::KeyCode jkeymap[] = {
00108     Common::KEYCODE_INVALID, // KEYCODE_UNKNOWN
00109     Common::KEYCODE_INVALID, // KEYCODE_SOFT_LEFT
00110     Common::KEYCODE_INVALID, // KEYCODE_SOFT_RIGHT
00111     Common::KEYCODE_INVALID, // KEYCODE_HOME
00112     Common::KEYCODE_INVALID, // KEYCODE_BACK
00113     Common::KEYCODE_INVALID, // KEYCODE_CALL
00114     Common::KEYCODE_INVALID, // KEYCODE_ENDCALL
00115     Common::KEYCODE_0, // KEYCODE_0
00116     Common::KEYCODE_1, // KEYCODE_1
00117     Common::KEYCODE_2, // KEYCODE_2
00118     Common::KEYCODE_3, // KEYCODE_3
00119     Common::KEYCODE_4, // KEYCODE_4
00120     Common::KEYCODE_5, // KEYCODE_5
00121     Common::KEYCODE_6, // KEYCODE_6
00122     Common::KEYCODE_7, // KEYCODE_7
00123     Common::KEYCODE_8, // KEYCODE_8
00124     Common::KEYCODE_9, // KEYCODE_9
00125     Common::KEYCODE_ASTERISK, // KEYCODE_STAR
00126     Common::KEYCODE_HASH, // KEYCODE_POUND
00127     Common::KEYCODE_INVALID, // KEYCODE_DPAD_UP
00128     Common::KEYCODE_INVALID, // KEYCODE_DPAD_DOWN
00129     Common::KEYCODE_INVALID, // KEYCODE_DPAD_LEFT
00130     Common::KEYCODE_INVALID, // KEYCODE_DPAD_RIGHT
00131     Common::KEYCODE_INVALID, // KEYCODE_DPAD_CENTER
00132     Common::KEYCODE_INVALID, // KEYCODE_VOLUME_UP
00133     Common::KEYCODE_INVALID, // KEYCODE_VOLUME_DOWN
00134     Common::KEYCODE_INVALID, // KEYCODE_POWER
00135     Common::KEYCODE_INVALID, // KEYCODE_CAMERA
00136     Common::KEYCODE_INVALID, // KEYCODE_CLEAR
00137     Common::KEYCODE_a, // KEYCODE_A
00138     Common::KEYCODE_b, // KEYCODE_B
00139     Common::KEYCODE_c, // KEYCODE_C
00140     Common::KEYCODE_d, // KEYCODE_D
00141     Common::KEYCODE_e, // KEYCODE_E
00142     Common::KEYCODE_f, // KEYCODE_F
00143     Common::KEYCODE_g, // KEYCODE_G
00144     Common::KEYCODE_h, // KEYCODE_H
00145     Common::KEYCODE_i, // KEYCODE_I
00146     Common::KEYCODE_j, // KEYCODE_J
00147     Common::KEYCODE_k, // KEYCODE_K
00148     Common::KEYCODE_l, // KEYCODE_L
00149     Common::KEYCODE_m, // KEYCODE_M
00150     Common::KEYCODE_n, // KEYCODE_N
00151     Common::KEYCODE_o, // KEYCODE_O
00152     Common::KEYCODE_p, // KEYCODE_P
00153     Common::KEYCODE_q, // KEYCODE_Q
00154     Common::KEYCODE_r, // KEYCODE_R
00155     Common::KEYCODE_s, // KEYCODE_S
00156     Common::KEYCODE_t, // KEYCODE_T
00157     Common::KEYCODE_u, // KEYCODE_U
00158     Common::KEYCODE_v, // KEYCODE_V
00159     Common::KEYCODE_w, // KEYCODE_W
00160     Common::KEYCODE_x, // KEYCODE_X
00161     Common::KEYCODE_y, // KEYCODE_Y
00162     Common::KEYCODE_z, // KEYCODE_Z
00163     Common::KEYCODE_COMMA, // KEYCODE_COMMA
00164     Common::KEYCODE_PERIOD, // KEYCODE_PERIOD
00165     Common::KEYCODE_LALT, // KEYCODE_ALT_LEFT
00166     Common::KEYCODE_RALT, // KEYCODE_ALT_RIGHT
00167     Common::KEYCODE_LSHIFT, // KEYCODE_SHIFT_LEFT
00168     Common::KEYCODE_RSHIFT, // KEYCODE_SHIFT_RIGHT
00169     Common::KEYCODE_TAB, // KEYCODE_TAB
00170     Common::KEYCODE_SPACE, // KEYCODE_SPACE
00171     Common::KEYCODE_LCTRL, // KEYCODE_SYM
00172     Common::KEYCODE_INVALID, // KEYCODE_EXPLORER
00173     Common::KEYCODE_INVALID, // KEYCODE_ENVELOPE
00174     Common::KEYCODE_RETURN, // KEYCODE_ENTER
00175     Common::KEYCODE_BACKSPACE, // KEYCODE_DEL
00176     Common::KEYCODE_BACKQUOTE, // KEYCODE_GRAVE
00177     Common::KEYCODE_MINUS, // KEYCODE_MINUS
00178     Common::KEYCODE_EQUALS, // KEYCODE_EQUALS
00179     Common::KEYCODE_LEFTPAREN, // KEYCODE_LEFT_BRACKET
00180     Common::KEYCODE_RIGHTPAREN, // KEYCODE_RIGHT_BRACKET
00181     Common::KEYCODE_BACKSLASH, // KEYCODE_BACKSLASH
00182     Common::KEYCODE_SEMICOLON, // KEYCODE_SEMICOLON
00183     Common::KEYCODE_QUOTE, // KEYCODE_APOSTROPHE
00184     Common::KEYCODE_SLASH, // KEYCODE_SLASH
00185     Common::KEYCODE_AT, // KEYCODE_AT
00186     Common::KEYCODE_INVALID, // KEYCODE_NUM
00187     Common::KEYCODE_INVALID, // KEYCODE_HEADSETHOOK
00188     Common::KEYCODE_INVALID, // KEYCODE_FOCUS
00189     Common::KEYCODE_PLUS, // KEYCODE_PLUS
00190     Common::KEYCODE_INVALID, // KEYCODE_MENU
00191     Common::KEYCODE_INVALID, // KEYCODE_NOTIFICATION
00192     Common::KEYCODE_INVALID, // KEYCODE_SEARCH
00193     Common::KEYCODE_INVALID, // KEYCODE_MEDIA_PLAY_PAUSE
00194     Common::KEYCODE_INVALID, // KEYCODE_MEDIA_STOP
00195     Common::KEYCODE_INVALID, // KEYCODE_MEDIA_NEXT
00196     Common::KEYCODE_INVALID, // KEYCODE_MEDIA_PREVIOUS
00197     Common::KEYCODE_INVALID, // KEYCODE_MEDIA_REWIND
00198     Common::KEYCODE_INVALID, // KEYCODE_MEDIA_FAST_FORWARD
00199     Common::KEYCODE_INVALID, // KEYCODE_MUTE
00200     Common::KEYCODE_PAGEUP, // KEYCODE_PAGE_UP
00201     Common::KEYCODE_PAGEDOWN, // KEYCODE_PAGE_DOWN
00202     Common::KEYCODE_INVALID,
00203     Common::KEYCODE_INVALID,
00204     // 96 and up: OUYA buttons.
00205     Common::KEYCODE_RETURN, // 96: OUYA O
00206     Common::KEYCODE_p, // 97: OUYA A
00207     Common::KEYCODE_INVALID,
00208     Common::KEYCODE_u, // 99: OUYA U
00209     Common::KEYCODE_i, // 100: OUYA Y
00210     Common::KEYCODE_INVALID,
00211     Common::KEYCODE_PAGEUP, // 102: OUYA L1
00212     Common::KEYCODE_PAGEDOWN, // 103: OUYA R1
00213     Common::KEYCODE_LSHIFT, // 104: OUYA L2
00214     Common::KEYCODE_LSHIFT, // 105: OUYA R2
00215     Common::KEYCODE_ESCAPE, // 106: Press left stick
00216     Common::KEYCODE_DELETE, // 107: Press right stick
00217     Common::KEYCODE_INVALID,
00218     Common::KEYCODE_INVALID,
00219     Common::KEYCODE_INVALID, // 110
00220     Common::KEYCODE_INVALID,
00221     Common::KEYCODE_INVALID,
00222     Common::KEYCODE_INVALID,
00223     Common::KEYCODE_INVALID,
00224     Common::KEYCODE_INVALID,
00225     Common::KEYCODE_INVALID,
00226     Common::KEYCODE_INVALID,
00227     Common::KEYCODE_INVALID,
00228     Common::KEYCODE_INVALID,
00229     Common::KEYCODE_INVALID, // 120
00230     Common::KEYCODE_INVALID,
00231     Common::KEYCODE_INVALID,
00232     Common::KEYCODE_INVALID,
00233     Common::KEYCODE_INVALID,
00234     Common::KEYCODE_INVALID,
00235     Common::KEYCODE_INVALID,
00236     Common::KEYCODE_INVALID,
00237     Common::KEYCODE_INVALID,
00238     Common::KEYCODE_INVALID,
00239     Common::KEYCODE_INVALID, // 130
00240     Common::KEYCODE_F1, // 131 : F1 key
00241     Common::KEYCODE_INVALID,
00242     Common::KEYCODE_INVALID,
00243     Common::KEYCODE_INVALID,
00244     Common::KEYCODE_INVALID,
00245     Common::KEYCODE_INVALID,
00246     Common::KEYCODE_INVALID,
00247     Common::KEYCODE_INVALID,
00248     Common::KEYCODE_INVALID,
00249     Common::KEYCODE_INVALID, // 140
00250     Common::KEYCODE_INVALID,
00251     Common::KEYCODE_INVALID,
00252     Common::KEYCODE_INVALID,
00253     Common::KEYCODE_INVALID,
00254     Common::KEYCODE_INVALID,
00255     Common::KEYCODE_INVALID,
00256     Common::KEYCODE_INVALID,
00257     Common::KEYCODE_INVALID,
00258     Common::KEYCODE_INVALID,
00259     Common::KEYCODE_INVALID, // 150
00260     
00261 };
00262 
00263 #endif


Generated on Sat Mar 16 2019 05:01:30 for ResidualVM by doxygen 1.7.1
curved edge   curved edge