aboutsummaryrefslogtreecommitdiff
path: root/engines/lab
diff options
context:
space:
mode:
authorStrangerke2015-12-19 12:13:25 +0100
committerWillem Jan Palenstijn2015-12-23 21:35:30 +0100
commit164b9d5a6674e3d8285a4277d2868030c4bb2cf1 (patch)
tree660d74cc09eb9ec2dba929abb60d78f9969893a5 /engines/lab
parentdf1376983d9181a5b08011bf3b5b4d8684d06b38 (diff)
downloadscummvm-rg350-164b9d5a6674e3d8285a4277d2868030c4bb2cf1.tar.gz
scummvm-rg350-164b9d5a6674e3d8285a4277d2868030c4bb2cf1.tar.bz2
scummvm-rg350-164b9d5a6674e3d8285a4277d2868030c4bb2cf1.zip
LAB: Use Common:KeyCode in keyPress() and getNextChar()
Diffstat (limited to 'engines/lab')
-rw-r--r--engines/lab/eventman.cpp6
-rw-r--r--engines/lab/eventman.h7
-rw-r--r--engines/lab/interface.cpp5
3 files changed, 11 insertions, 7 deletions
diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp
index 7f0ddb8e18..000aaa7cb6 100644
--- a/engines/lab/eventman.cpp
+++ b/engines/lab/eventman.cpp
@@ -211,7 +211,7 @@ void EventManager::setMousePos(Common::Point pos) {
/**
* Checks whether or not a key has been pressed.
*/
-bool EventManager::keyPress(uint16 *keyCode) {
+bool EventManager::keyPress(Common::KeyCode *keyCode) {
if (haveNextChar()) {
*keyCode = getNextChar();
return true;
@@ -280,8 +280,8 @@ void EventManager::processInput() {
}
}
-uint16 EventManager::getNextChar() {
- uint16 chr = 0;
+Common::KeyCode EventManager::getNextChar() {
+ Common::KeyCode chr = Common::KEYCODE_INVALID;
processInput();
if (_nextKeyIn != _nextKeyOut) {
diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h
index 6563467eb8..eab5f31c80 100644
--- a/engines/lab/eventman.h
+++ b/engines/lab/eventman.h
@@ -53,7 +53,8 @@ enum MessageClasses {
struct IntuiMessage {
uint32 _msgClass;
- uint16 _code, _qualifier;
+ uint16 _code; // KeyCode or Button Id
+ uint16 _qualifier;
Common::Point _mouse;
};
@@ -87,9 +88,9 @@ private:
private:
Button *checkButtonHit(ButtonList *buttonList, Common::Point pos);
- bool keyPress(uint16 *keyCode);
+ bool keyPress(Common::KeyCode *keyCode);
bool haveNextChar();
- uint16 getNextChar();
+ Common::KeyCode getNextChar();
Button *checkNumButtonHit(ButtonList *buttonList, uint16 key);
uint16 makeButtonKeyEquiv(uint16 key);
diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp
index c47339c10f..41749f1256 100644
--- a/engines/lab/interface.cpp
+++ b/engines/lab/interface.cpp
@@ -128,6 +128,8 @@ IntuiMessage *EventManager::getMsg() {
updateMouse();
+ Common::KeyCode curKey;
+
if (_lastButtonHit) {
updateMouse();
message._msgClass = kMessageButtonUp;
@@ -143,7 +145,8 @@ IntuiMessage *EventManager::getMsg() {
message._mouse.x /= 2;
_leftClick = _rightClick = false;
return &message;
- } else if (keyPress(&message._code)) {
+ } else if (keyPress(&curKey)) {
+ message._code = curKey;
Button *curButton = checkNumButtonHit(_screenButtonList, message._code);
if (curButton) {