[Scummvm-cvs-logs] SF.net SVN: scummvm: [26168] scummvm/trunk/engines/agi/text.cpp
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Sat Mar 17 14:31:49 CET 2007
Revision: 26168
http://scummvm.svn.sourceforge.net/scummvm/?rev=26168&view=rev
Author: eriktorbjorn
Date: 2007-03-17 06:31:48 -0700 (Sat, 17 Mar 2007)
Log Message:
-----------
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.)
Modified Paths:
--------------
scummvm/trunk/engines/agi/text.cpp
Modified: scummvm/trunk/engines/agi/text.cpp
===================================================================
--- scummvm/trunk/engines/agi/text.cpp 2007-03-17 13:20:39 UTC (rev 26167)
+++ scummvm/trunk/engines/agi/text.cpp 2007-03-17 13:31:48 UTC (rev 26168)
@@ -310,6 +310,7 @@
* @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 @@
/* Automatically position buttons */
for (i = 0; b[i]; i++) {
+ numButtons++;
s -= CHAR_COLS * strlen(b[i]);
}
@@ -362,6 +364,16 @@
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])) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list