aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2007-03-17 13:31:48 +0000
committerTorbjörn Andersson2007-03-17 13:31:48 +0000
commitd378b78b6a17acd7649aca989803cc42873f8641 (patch)
tree2c9d37ffc8e76c01fdd271585e6ca8319e4fda8a
parent56143c4c731d29af92475d7480f11958710bae51 (diff)
downloadscummvm-rg350-d378b78b6a17acd7649aca989803cc42873f8641.tar.gz
scummvm-rg350-d378b78b6a17acd7649aca989803cc42873f8641.tar.bz2
scummvm-rg350-d378b78b6a17acd7649aca989803cc42873f8641.zip
Allow using the left/right keys to select button in a selection box. (Selection
boxes are used, for instance, when asking the player to verify that he wants to save the game to a specific slot.) svn-id: r26168
-rw-r--r--engines/agi/text.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index 70d7e25d58..8414e47011 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -310,6 +310,7 @@ int AgiEngine::messageBox(const char *s) {
* @param b NULL-terminated list of button labels
*/
int AgiEngine::selectionBox(const char *m, const char **b) {
+ int numButtons = 0;
int x, y, i, s;
int key, active = 0;
int rc = -1;
@@ -325,6 +326,7 @@ int AgiEngine::selectionBox(const char *m, const char **b) {
/* Automatically position buttons */
for (i = 0; b[i]; i++) {
+ numButtons++;
s -= CHAR_COLS * strlen(b[i]);
}
@@ -362,6 +364,16 @@ int AgiEngine::selectionBox(const char *m, const char **b) {
case KEY_ESCAPE:
rc = -1;
goto getout;
+ case KEY_RIGHT:
+ active++;
+ if (active >= numButtons)
+ active = 0;
+ break;
+ case KEY_LEFT:
+ active--;
+ if (active < 0)
+ active = numButtons - 1;
+ break;
case BUTTON_LEFT:
for (i = 0; b[i]; i++) {
if (_gfx->testButton(bx[i], by[i], b[i])) {