diff options
author | Nipun Garg | 2019-06-29 02:47:08 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:04 +0200 |
commit | 8a63a2169d53e43388a513f251e7b9defa3e632b (patch) | |
tree | 2970e72b8680c22c43a749c9f7d9084cc541e47b /engines/hdb | |
parent | ad2fa4185a8088d2a3eeb24c0138bd259a1b1e4b (diff) | |
download | scummvm-rg350-8a63a2169d53e43388a513f251e7b9defa3e632b.tar.gz scummvm-rg350-8a63a2169d53e43388a513f251e7b9defa3e632b.tar.bz2 scummvm-rg350-8a63a2169d53e43388a513f251e7b9defa3e632b.zip |
HDB: Add updateKeys()
Diffstat (limited to 'engines/hdb')
-rw-r--r-- | engines/hdb/input.cpp | 79 | ||||
-rw-r--r-- | engines/hdb/input.h | 7 |
2 files changed, 82 insertions, 4 deletions
diff --git a/engines/hdb/input.cpp b/engines/hdb/input.cpp index d9e0cbefc0..3ea214eadc 100644 --- a/engines/hdb/input.cpp +++ b/engines/hdb/input.cpp @@ -27,7 +27,15 @@ namespace HDB { bool Input::init() { _stylusDown = false; - warning("STUB: Input::init: Set the default key values"); + _keyUp = Common::KEYCODE_UP; + _keyDown = Common::KEYCODE_DOWN; + _keyLeft = Common::KEYCODE_LEFT; + _keyRight = Common::KEYCODE_RIGHT; + _keyMenu = Common::KEYCODE_ESCAPE; + _keyUse = Common::KEYCODE_RETURN; + _keyInv = Common::KEYCODE_SPACE; + _keyDebug = Common::KEYCODE_F1; + _keyQuit = Common::KEYCODE_F10; _mouseX = kScreenWidth / 2; _mouseY = kScreenHeight / 2; @@ -219,4 +227,73 @@ void Input::updateMouseButtons(int l, int m, int r) { } } +void Input::updateKeys(Common::Event event, bool keyDown) { + + warning("STUB: updateKeys: Check for Quit key"); + warning("STUB: updateKeys: Check for Pause key"); + + uint16 buttons = getButtons(); + + if (!g_hdb->getPause()) { + if (event.kbd.keycode == _keyUp) { + if (keyDown) { + buttons |= kButtonUp; + if (g_hdb->_drawMan->getPointer()) + g_hdb->_drawMan->showPointer(false); + } else { + buttons &= ~kButtonUp; + } + } else if (event.kbd.keycode == _keyDown) { + if (keyDown) { + buttons |= kButtonDown; + if (g_hdb->_drawMan->getPointer()) + g_hdb->_drawMan->showPointer(false); + } else { + buttons &= ~kButtonDown; + } + } else if (event.kbd.keycode == _keyLeft) { + if (keyDown) { + buttons |= kButtonLeft; + if (g_hdb->_drawMan->getPointer()) + g_hdb->_drawMan->showPointer(false); + } else { + buttons &= ~kButtonLeft; + } + } else if (event.kbd.keycode == _keyRight) { + if (keyDown) { + buttons |= kButtonRight; + if (g_hdb->_drawMan->getPointer()) + g_hdb->_drawMan->showPointer(false); + } else { + buttons &= ~kButtonRight; + } + } else if (event.kbd.keycode == _keyUse) { + if (keyDown) { + buttons |= kButtonB; + if (g_hdb->_drawMan->getPointer()) + g_hdb->_drawMan->showPointer(false); + } else { + buttons &= ~kButtonB; + } + } + } + + if (event.kbd.keycode == _keyMenu) { + if (keyDown) { + buttons |= kButtonA; + g_hdb->_drawMan->showPointer(true); + } else { + buttons &= ~kButtonA; + } + } else if (event.kbd.keycode == _keyDebug) { + if (keyDown) { + buttons |= kButtonExit; + } else { + buttons &= ~kButtonExit; + } + } + + setButtons(buttons); +} + } // End of Namespace diff --git a/engines/hdb/input.h b/engines/hdb/input.h index a296bba391..d12f33346a 100644 --- a/engines/hdb/input.h +++ b/engines/hdb/input.h @@ -52,6 +52,7 @@ public: void updateMouse(int newX, int newY); void updateMouseButtons(int l, int m, int r); + void updateKeys(Common::Event event, bool keyDown); int getMouseX() { return _mouseX; @@ -69,9 +70,9 @@ private: int _mouseLButton, _mouseMButton, _mouseRButton; // Definable Keys - int _keyUp, _keyDown, _keyLeft, _keyRight; - int _keyInv, _keyUse, _keyMenu, _keyDebug; - int _keyQuit; + Common::KeyCode _keyUp, _keyDown, _keyLeft, _keyRight; + Common::KeyCode _keyInv, _keyUse, _keyMenu, _keyDebug; + Common::KeyCode _keyQuit; }; } // End of Namespace |