From 68908773ac0ef335f491a257473358269616ab69 Mon Sep 17 00:00:00 2001 From: dhewg Date: Fri, 25 Mar 2011 19:52:33 +0100 Subject: ANDROID: Use 'our' ASCII codes for special keys Fixes stuff like enter key on SCI games with text input --- backends/platform/android/events.cpp | 58 +++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index c969068d70..d845ab8ffc 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -366,7 +366,63 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, if (arg5 > 0) e.synthetic = true; - e.kbd.ascii = arg3; + // map special keys to 'our' ascii codes + switch (e.kbd.keycode) { + case Common::KEYCODE_BACKSPACE: + e.kbd.ascii = Common::ASCII_BACKSPACE; + break; + case Common::KEYCODE_TAB: + e.kbd.ascii = Common::ASCII_TAB; + break; + case Common::KEYCODE_RETURN: + e.kbd.ascii = Common::ASCII_RETURN; + break; + case Common::KEYCODE_ESCAPE: + e.kbd.ascii = Common::ASCII_ESCAPE; + break; + case Common::KEYCODE_SPACE: + e.kbd.ascii = Common::ASCII_SPACE; + break; + case Common::KEYCODE_F1: + e.kbd.ascii = Common::ASCII_F1; + break; + case Common::KEYCODE_F2: + e.kbd.ascii = Common::ASCII_F2; + break; + case Common::KEYCODE_F3: + e.kbd.ascii = Common::ASCII_F3; + break; + case Common::KEYCODE_F4: + e.kbd.ascii = Common::ASCII_F4; + break; + case Common::KEYCODE_F5: + e.kbd.ascii = Common::ASCII_F5; + break; + case Common::KEYCODE_F6: + e.kbd.ascii = Common::ASCII_F6; + break; + case Common::KEYCODE_F7: + e.kbd.ascii = Common::ASCII_F7; + break; + case Common::KEYCODE_F8: + e.kbd.ascii = Common::ASCII_F8; + break; + case Common::KEYCODE_F9: + e.kbd.ascii = Common::ASCII_F9; + break; + case Common::KEYCODE_F10: + e.kbd.ascii = Common::ASCII_F10; + break; + case Common::KEYCODE_F11: + e.kbd.ascii = Common::ASCII_F11; + break; + case Common::KEYCODE_F12: + e.kbd.ascii = Common::ASCII_F12; + break; + default: + e.kbd.ascii = arg3; + break; + } if (arg4 & JMETA_SHIFT) e.kbd.flags |= Common::KBD_SHIFT; -- cgit v1.2.3