diff options
author | Max Horn | 2007-06-22 23:03:12 +0000 |
---|---|---|
committer | Max Horn | 2007-06-22 23:03:12 +0000 |
commit | a041ef23174a21eb42285e8c518f38b81468b13d (patch) | |
tree | 0104912998af89016c5d935fda66898b13d400ef /engines/kyra | |
parent | d0ee1b3c8ff521707a6f5064ee54638460aaee21 (diff) | |
download | scummvm-rg350-a041ef23174a21eb42285e8c518f38b81468b13d.tar.gz scummvm-rg350-a041ef23174a21eb42285e8c518f38b81468b13d.tar.bz2 scummvm-rg350-a041ef23174a21eb42285e8c518f38b81468b13d.zip |
Slightly updated key handling in BS2, Kyra, and Touche
svn-id: r27637
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/gui.cpp | 18 | ||||
-rw-r--r-- | engines/kyra/kyra.h | 3 |
2 files changed, 12 insertions, 9 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index 18fdd4436d..8cafb54fb8 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -596,7 +596,7 @@ int KyraEngine::buttonMenuCallback(Button *caller) { calcCoords(_menu[i]); _menuRestoreScreen = true; - _keyPressed = 0; + _keyPressed.reset(); _mousePressFlag = false; _toplevelMenu = 0; @@ -826,7 +826,7 @@ void KyraEngine::gui_getInput() { _mouseWheel = 1; break; case Common::EVENT_KEYDOWN: - _keyPressed = event.kbd.ascii; + _keyPressed = event.kbd; break; default: break; @@ -1002,26 +1002,28 @@ void KyraEngine::gui_redrawTextfield() { void KyraEngine::gui_updateSavegameString() { int length; - if (_keyPressed) { + if (_keyPressed.keycode) { length = strlen(_savegameName); - if (_keyPressed > 31 && _keyPressed < 127) { + if (_keyPressed.ascii > 31 && _keyPressed.ascii < 127) { if (length < 31) { - _savegameName[length] = _keyPressed; + _savegameName[length] = _keyPressed.ascii; _savegameName[length+1] = 0; gui_redrawTextfield(); } - } else if (_keyPressed == 8 ||_keyPressed == 127) { + } else if (_keyPressed.keycode == Common::KEYCODE_BACKSPACE || + _keyPressed.keycode == Common::KEYCODE_DELETE) { if (length > 0) { _savegameName[length-1] = 0; gui_redrawTextfield(); } - } else if (_keyPressed == 13) { + } else if (_keyPressed.keycode == Common::KEYCODE_RETURN || + _keyPressed.keycode == Common::KEYCODE_KP_ENTER) { _displaySubMenu = false; } } - _keyPressed = 0; + _keyPressed.reset(); } int KyraEngine::gui_saveGame(Button *button) { diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h index 9d891ee511..bb41a68e6b 100644 --- a/engines/kyra/kyra.h +++ b/engines/kyra/kyra.h @@ -29,6 +29,7 @@ #include "engines/engine.h" #include "common/rect.h" #include "common/array.h" +#include "common/events.h" namespace Kyra { @@ -744,7 +745,7 @@ protected: int _gameToLoad; char _savegameName[31]; const char *_specialSavegameString; - uint8 _keyPressed; + Common::KeyState _keyPressed; struct KyragemState { uint16 nextOperation; |