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_LMB_DOWN = 9,
00051     JE_LMB_UP = 10,
00052     JE_RMB_DOWN = 11,
00053     JE_RMB_UP = 12,
00054     JE_MOUSE_MOVE = 13,
00055     JE_MMB_DOWN = 16,
00056     JE_MMB_UP = 17,
00057     JE_TOUCH = 18,
00058     JE_LONG = 19,
00059     JE_FLING = 20,
00060     JE_QUIT = 0x1000
00061 };
00062 
00063 // action type
00064 enum {
00065     JACTION_DOWN = 0,
00066     JACTION_UP = 1,
00067     JACTION_MULTIPLE = 2,
00068     JACTION_POINTER_DOWN = 5,
00069     JACTION_POINTER_UP = 6
00070 };
00071 
00072 // system keys
00073 enum {
00074     JKEYCODE_SOFT_RIGHT = 2,
00075     JKEYCODE_HOME = 3,
00076     JKEYCODE_BACK = 4,
00077     JKEYCODE_CALL = 5,
00078     JKEYCODE_ENDCALL = 6,
00079     JKEYCODE_VOLUME_UP = 24,
00080     JKEYCODE_VOLUME_DOWN = 25,
00081     JKEYCODE_POWER = 26,
00082     JKEYCODE_CAMERA = 27,
00083     JKEYCODE_HEADSETHOOK = 79,
00084     JKEYCODE_FOCUS = 80,
00085     JKEYCODE_MENU = 82,
00086     JKEYCODE_SEARCH = 84,
00087     JKEYCODE_MUTE = 91,
00088     JKEYCODE_MEDIA_PLAY_PAUSE = 85,
00089     JKEYCODE_MEDIA_STOP = 86,
00090     JKEYCODE_MEDIA_NEXT = 87,
00091     JKEYCODE_MEDIA_PREVIOUS = 88,
00092     JKEYCODE_MEDIA_REWIND = 89,
00093     JKEYCODE_MEDIA_FAST_FORWARD = 90,
00094     JKEYCODE_MEDIA_PLAY = 126,
00095     JKEYCODE_MEDIA_PAUSE = 127
00096 };
00097 
00098 // five-way navigation control
00099 enum {
00100     JKEYCODE_DPAD_UP = 19,
00101     JKEYCODE_DPAD_DOWN = 20,
00102     JKEYCODE_DPAD_LEFT = 21,
00103     JKEYCODE_DPAD_RIGHT = 22,
00104     JKEYCODE_DPAD_CENTER = 23
00105 };
00106 
00107 // meta modifier
00108 enum {
00109     JMETA_SHIFT = 0x01,
00110     JMETA_ALT = 0x02,
00111     JMETA_SYM = 0x04,
00112     JMETA_CTRL = 0x1000
00113 };
00114 
00115 // map android key codes to our kbd codes
00116 static const Common::KeyCode jkeymap[] = {
00117     Common::KEYCODE_INVALID, // KEYCODE_UNKNOWN
00118     Common::KEYCODE_INVALID, // KEYCODE_SOFT_LEFT
00119     Common::KEYCODE_INVALID, // KEYCODE_SOFT_RIGHT
00120     Common::KEYCODE_INVALID, // KEYCODE_HOME
00121     Common::KEYCODE_INVALID, // KEYCODE_BACK
00122     Common::KEYCODE_INVALID, // KEYCODE_CALL
00123     Common::KEYCODE_INVALID, // KEYCODE_ENDCALL
00124     Common::KEYCODE_0, // KEYCODE_0
00125     Common::KEYCODE_1, // KEYCODE_1
00126     Common::KEYCODE_2, // KEYCODE_2
00127     Common::KEYCODE_3, // KEYCODE_3
00128     Common::KEYCODE_4, // KEYCODE_4
00129     Common::KEYCODE_5, // KEYCODE_5
00130     Common::KEYCODE_6, // KEYCODE_6
00131     Common::KEYCODE_7, // KEYCODE_7
00132     Common::KEYCODE_8, // KEYCODE_8
00133     Common::KEYCODE_9, // KEYCODE_9
00134     Common::KEYCODE_ASTERISK, // KEYCODE_STAR
00135     Common::KEYCODE_HASH, // KEYCODE_POUND
00136     Common::KEYCODE_INVALID, // KEYCODE_DPAD_UP
00137     Common::KEYCODE_INVALID, // KEYCODE_DPAD_DOWN
00138     Common::KEYCODE_INVALID, // KEYCODE_DPAD_LEFT
00139     Common::KEYCODE_INVALID, // KEYCODE_DPAD_RIGHT
00140     Common::KEYCODE_INVALID, // KEYCODE_DPAD_CENTER
00141     Common::KEYCODE_INVALID, // KEYCODE_VOLUME_UP
00142     Common::KEYCODE_INVALID, // KEYCODE_VOLUME_DOWN
00143     Common::KEYCODE_INVALID, // KEYCODE_POWER
00144     Common::KEYCODE_INVALID, // KEYCODE_CAMERA
00145     Common::KEYCODE_INVALID, // KEYCODE_CLEAR
00146     Common::KEYCODE_a, // KEYCODE_A
00147     Common::KEYCODE_b, // KEYCODE_B
00148     Common::KEYCODE_c, // KEYCODE_C
00149     Common::KEYCODE_d, // KEYCODE_D
00150     Common::KEYCODE_e, // KEYCODE_E
00151     Common::KEYCODE_f, // KEYCODE_F
00152     Common::KEYCODE_g, // KEYCODE_G
00153     Common::KEYCODE_h, // KEYCODE_H
00154     Common::KEYCODE_i, // KEYCODE_I
00155     Common::KEYCODE_j, // KEYCODE_J
00156     Common::KEYCODE_k, // KEYCODE_K
00157     Common::KEYCODE_l, // KEYCODE_L
00158     Common::KEYCODE_m, // KEYCODE_M
00159     Common::KEYCODE_n, // KEYCODE_N
00160     Common::KEYCODE_o, // KEYCODE_O
00161     Common::KEYCODE_p, // KEYCODE_P
00162     Common::KEYCODE_q, // KEYCODE_Q
00163     Common::KEYCODE_r, // KEYCODE_R
00164     Common::KEYCODE_s, // KEYCODE_S
00165     Common::KEYCODE_t, // KEYCODE_T
00166     Common::KEYCODE_u, // KEYCODE_U
00167     Common::KEYCODE_v, // KEYCODE_V
00168     Common::KEYCODE_w, // KEYCODE_W
00169     Common::KEYCODE_x, // KEYCODE_X
00170     Common::KEYCODE_y, // KEYCODE_Y
00171     Common::KEYCODE_z, // KEYCODE_Z
00172     Common::KEYCODE_COMMA, // KEYCODE_COMMA
00173     Common::KEYCODE_PERIOD, // KEYCODE_PERIOD
00174     Common::KEYCODE_LALT, // KEYCODE_ALT_LEFT
00175     Common::KEYCODE_RALT, // KEYCODE_ALT_RIGHT
00176     Common::KEYCODE_LSHIFT, // KEYCODE_SHIFT_LEFT
00177     Common::KEYCODE_RSHIFT, // KEYCODE_SHIFT_RIGHT
00178     Common::KEYCODE_TAB, // KEYCODE_TAB
00179     Common::KEYCODE_SPACE, // KEYCODE_SPACE
00180     Common::KEYCODE_LCTRL, // KEYCODE_SYM
00181     Common::KEYCODE_INVALID, // KEYCODE_EXPLORER
00182     Common::KEYCODE_INVALID, // KEYCODE_ENVELOPE
00183     Common::KEYCODE_RETURN, // KEYCODE_ENTER
00184     Common::KEYCODE_BACKSPACE, // KEYCODE_DEL
00185     Common::KEYCODE_BACKQUOTE, // KEYCODE_GRAVE
00186     Common::KEYCODE_MINUS, // KEYCODE_MINUS
00187     Common::KEYCODE_EQUALS, // KEYCODE_EQUALS
00188     Common::KEYCODE_LEFTPAREN, // KEYCODE_LEFT_BRACKET
00189     Common::KEYCODE_RIGHTPAREN, // KEYCODE_RIGHT_BRACKET
00190     Common::KEYCODE_BACKSLASH, // KEYCODE_BACKSLASH
00191     Common::KEYCODE_SEMICOLON, // KEYCODE_SEMICOLON
00192     Common::KEYCODE_QUOTE, // KEYCODE_APOSTROPHE
00193     Common::KEYCODE_SLASH, // KEYCODE_SLASH
00194     Common::KEYCODE_AT, // KEYCODE_AT
00195     Common::KEYCODE_INVALID, // KEYCODE_NUM
00196     Common::KEYCODE_INVALID, // KEYCODE_HEADSETHOOK
00197     Common::KEYCODE_INVALID, // KEYCODE_FOCUS
00198     Common::KEYCODE_PLUS, // KEYCODE_PLUS
00199     Common::KEYCODE_INVALID, // KEYCODE_MENU
00200     Common::KEYCODE_INVALID, // KEYCODE_NOTIFICATION
00201     Common::KEYCODE_INVALID, // KEYCODE_SEARCH
00202     Common::KEYCODE_INVALID, // KEYCODE_MEDIA_PLAY_PAUSE
00203     Common::KEYCODE_INVALID, // KEYCODE_MEDIA_STOP
00204     Common::KEYCODE_INVALID, // KEYCODE_MEDIA_NEXT
00205     Common::KEYCODE_INVALID, // KEYCODE_MEDIA_PREVIOUS
00206     Common::KEYCODE_INVALID, // KEYCODE_MEDIA_REWIND
00207     Common::KEYCODE_INVALID, // KEYCODE_MEDIA_FAST_FORWARD
00208     Common::KEYCODE_INVALID, // KEYCODE_MUTE
00209     Common::KEYCODE_PAGEUP, // KEYCODE_PAGE_UP
00210     Common::KEYCODE_PAGEDOWN, // KEYCODE_PAGE_DOWN
00211     Common::KEYCODE_INVALID,
00212     Common::KEYCODE_INVALID,
00213     // 96 and up: OUYA buttons.
00214     Common::KEYCODE_RETURN, // 96: OUYA O
00215     Common::KEYCODE_p, // 97: OUYA A
00216     Common::KEYCODE_INVALID,
00217     Common::KEYCODE_u, // 99: OUYA U
00218     Common::KEYCODE_i, // 100: OUYA Y
00219     Common::KEYCODE_INVALID,
00220     Common::KEYCODE_PAGEUP, // 102: OUYA L1
00221     Common::KEYCODE_PAGEDOWN, // 103: OUYA R1
00222     Common::KEYCODE_LSHIFT, // 104: OUYA L2
00223     Common::KEYCODE_LSHIFT, // 105: OUYA R2
00224     Common::KEYCODE_ESCAPE, // 106: Press left stick
00225     Common::KEYCODE_DELETE, // 107: Press right stick
00226     Common::KEYCODE_INVALID,
00227     Common::KEYCODE_INVALID,
00228     Common::KEYCODE_INVALID, // 110
00229     Common::KEYCODE_INVALID,
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, // 120
00239     Common::KEYCODE_INVALID,
00240     Common::KEYCODE_INVALID,
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, // 130
00249     Common::KEYCODE_F1, // 131 : F1 key
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, // 140
00259     Common::KEYCODE_INVALID,
00260     Common::KEYCODE_INVALID,
00261     Common::KEYCODE_INVALID,
00262     Common::KEYCODE_INVALID,
00263     Common::KEYCODE_INVALID,
00264     Common::KEYCODE_INVALID,
00265     Common::KEYCODE_INVALID,
00266     Common::KEYCODE_INVALID,
00267     Common::KEYCODE_INVALID,
00268     Common::KEYCODE_INVALID, // 150
00269     
00270 };
00271 
00272 #endif


Generated on Sat May 18 2019 05:01:01 for ResidualVM by doxygen 1.7.1
curved edge   curved edge