diff options
Diffstat (limited to 'src/client/inputhandler.h')
-rw-r--r-- | src/client/inputhandler.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/client/inputhandler.h b/src/client/inputhandler.h index 7487bbdc7..766cd5266 100644 --- a/src/client/inputhandler.h +++ b/src/client/inputhandler.h @@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #endif class InputHandler; +class TouchScreenGUI; /**************************************************************************** Fast key cache for main game loop @@ -197,7 +198,6 @@ public: TouchScreenGUI *m_touchscreengui; #endif -private: // The current state of keys KeyList keyIsDown; @@ -235,6 +235,8 @@ public: } virtual bool isKeyDown(GameKeyType k) = 0; + virtual void setKeypress(const KeyPress &keyCode) = 0; + virtual void unsetKeypress(const KeyPress &keyCode) = 0; virtual bool wasKeyDown(GameKeyType k) = 0; virtual bool wasKeyPressed(GameKeyType k) = 0; virtual bool wasKeyReleased(GameKeyType k) = 0; @@ -273,6 +275,15 @@ public: { return m_receiver->IsKeyDown(keycache.key[k]) || joystick.isKeyDown(k); } + virtual void setKeypress(const KeyPress &keyCode) + { + m_receiver->keyIsDown.set(keyCode); + m_receiver->keyWasDown.set(keyCode); + } + virtual void unsetKeypress(const KeyPress &keyCode) + { + m_receiver->keyIsDown.unset(keyCode); + } virtual bool wasKeyDown(GameKeyType k) { return m_receiver->WasKeyDown(keycache.key[k]) || joystick.wasKeyDown(k); @@ -332,7 +343,7 @@ public: m_receiver->clearInput(); } -private: + private: MyEventReceiver *m_receiver = nullptr; v2s32 m_mousepos; }; @@ -348,6 +359,14 @@ public: } virtual bool isKeyDown(GameKeyType k) { return keydown[keycache.key[k]]; } + virtual void setKeypress(const KeyPress &keyCode) + { + keydown.set(keyCode); + } + virtual void unsetKeypress(const KeyPress &keyCode) + { + keydown.unset(keyCode); + } virtual bool wasKeyDown(GameKeyType k) { return false; } virtual bool wasKeyPressed(GameKeyType k) { return false; } virtual bool wasKeyReleased(GameKeyType k) { return false; } |