aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-03-31 23:40:30 -0400
committerPaul Gilbert2016-03-31 23:40:30 -0400
commit43f183c207023c4398548ae385c9f3cbf853d9a9 (patch)
tree64f62004696566cf406f188729c7d03cead60749
parent18fabbb2d40ce9456d4673c0b7c602f50458b583 (diff)
downloadscummvm-rg350-43f183c207023c4398548ae385c9f3cbf853d9a9.tar.gz
scummvm-rg350-43f183c207023c4398548ae385c9f3cbf853d9a9.tar.bz2
scummvm-rg350-43f183c207023c4398548ae385c9f3cbf853d9a9.zip
TITANIC: Implement keyboard event handling
-rw-r--r--engines/titanic/events.cpp3
-rw-r--r--engines/titanic/input_translator.cpp12
-rw-r--r--engines/titanic/input_translator.h2
3 files changed, 17 insertions, 0 deletions
diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp
index 5202d7cb9c..038bc8b83b 100644
--- a/engines/titanic/events.cpp
+++ b/engines/titanic/events.cpp
@@ -187,6 +187,9 @@ void Events::keyDown(Common::KeyState keyState) {
_vm->_debugger->attach();
_vm->_debugger->onFrame();
}
+
+ if (_vm->_window->_inputAllowed)
+ _vm->_window->_gameManager->_inputTranslator.keyDown(keyState);
}
void Events::keyUp(Common::KeyState keyState) {
diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp
index 2251c2fe7a..9769076a1d 100644
--- a/engines/titanic/input_translator.cpp
+++ b/engines/titanic/input_translator.cpp
@@ -94,4 +94,16 @@ void CInputTranslator::rightButtonDoubleClick(int special, const Point &pt) {
_inputHandler->handleMessage(msg);
}
+void CInputTranslator::keyDown(const Common::KeyState &keyState) {
+ if (keyState.keycode >= Common::KEYCODE_F1 && keyState.keycode <= Common::KEYCODE_F5) {
+ CVirtualKeyCharMsg msg(keyState);
+ _inputHandler->handleMessage(msg);
+ }
+
+ if (keyState.ascii >= 32 && keyState.ascii <= 127) {
+ CKeyCharMsg msg(keyState.ascii);
+ _inputHandler->handleMessage(msg);
+ }
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/input_translator.h b/engines/titanic/input_translator.h
index ad4f2d9d0a..7ca2a78699 100644
--- a/engines/titanic/input_translator.h
+++ b/engines/titanic/input_translator.h
@@ -23,6 +23,7 @@
#ifndef TITANIC_INPUT_TRANSLATOR_H
#define TITANIC_INPUT_TRANSLATOR_H
+#include "common/keyboard.h"
#include "titanic/messages/mouse_messages.h"
namespace Titanic {
@@ -50,6 +51,7 @@ public:
void rightButtonDown(int special, const Point &pt);
void rightButtonUp(int special, const Point &pt);
void rightButtonDoubleClick(int special, const Point &pt);
+ void keyDown(const Common::KeyState &keyState);
};
} // End of namespace Titanic