aboutsummaryrefslogtreecommitdiff
path: root/queen/input.cpp
diff options
context:
space:
mode:
authorGregory Montoir2003-11-09 20:50:03 +0000
committerGregory Montoir2003-11-09 20:50:03 +0000
commitc9feb712bc0fa6fe51082eaf7b3c22ef1aa0b673 (patch)
treea7675b4662be2e1774a922e1f989759eb8839f42 /queen/input.cpp
parent79f84425dd3abc7239531b1c9ef1ccc155703a8b (diff)
downloadscummvm-rg350-c9feb712bc0fa6fe51082eaf7b3c22ef1aa0b673.tar.gz
scummvm-rg350-c9feb712bc0fa6fe51082eaf7b3c22ef1aa0b673.tar.bz2
scummvm-rg350-c9feb712bc0fa6fe51082eaf7b3c22ef1aa0b673.zip
enable (some of) the original debug passwords
svn-id: r11227
Diffstat (limited to 'queen/input.cpp')
-rw-r--r--queen/input.cpp44
1 files changed, 42 insertions, 2 deletions
diff --git a/queen/input.cpp b/queen/input.cpp
index be227032b3..558702dc80 100644
--- a/queen/input.cpp
+++ b/queen/input.cpp
@@ -126,7 +126,7 @@ void Input::delay(uint amount) {
} while (cur < start + amount);
}
-void Input::checkKeys() {
+int Input::checkKeys() {
if (_inKey)
debug(0, "[Input::checkKeys] _inKey = %i", _inKey);
@@ -205,8 +205,48 @@ void Input::checkKeys() {
_keyVerb = Verb(VERB_USE);
break;
}
-
+
+ int inKey = _inKey;
_inKey = 0; //reset
+ return inKey;
+}
+
+
+bool Input::waitForNumber(int &i, keyPressedCallback callback, void *refCon) {
+
+ i = 0;
+ int key = 0;
+ do {
+ delay(DELAY_SHORT);
+ key = _inKey;
+ _inKey = 0;
+ if (key >= '0' && key <= '9') {
+ i = i * 10 + key - '0';
+ (*callback)(refCon, key);
+ }
+ else if (key == KEY_BACKSPACE) {
+ i /= 10;
+ (*callback)(refCon, -1);
+ }
+ } while (key != KEY_ESCAPE && key != KEY_RETURN);
+ return key != KEY_ESCAPE;
+}
+
+
+bool Input::waitForCharacter(char &c) {
+
+ int key = 0;
+ do {
+ delay(DELAY_SHORT);
+ if (_inKey >= 'a' && _inKey <= 'z' || _inKey == KEY_ESCAPE) {
+ key = _inKey;
+ if (_inKey != KEY_ESCAPE) {
+ c = (char)_inKey;
+ }
+ }
+ _inKey = 0;
+ } while (key == 0);
+ return key != KEY_ESCAPE;
}