Add Amiga-style menus (FR #657645). Used in Amiga-rendering mode.

svn-id: r28015
This commit is contained in:
Kari Salminen 2007-07-10 18:32:24 +00:00
parent 969df42d01
commit 6e77abc07f
4 changed files with 21 additions and 2 deletions

View File

@ -571,6 +571,24 @@ void GfxMgr::drawDefaultStyleButton(int x, int y, const char *s, int a, int p, i
rawDrawButton(x, y, s, color.fg, color.bg, border, textOffset);
}
/**
* Draw a button using the currently chosen style.
* Amiga-style is used for the Amiga-rendering mode, PC-style is used otherwise.
* @param x x coordinate of the button
* @param y y coordinate of the button
* @param hasFocus set if the button has focus
* @param pressed set if the button is pressed
* @param positive set if button is positive, otherwise button is negative (Only matters with Amiga-style buttons)
* TODO: Make Amiga-style buttons a bit wider as they were in Amiga AGI games.
*/
void GfxMgr::drawCurrentStyleButton(int x, int y, const char *label, bool hasFocus, bool pressed, bool positive) {
int textOffset = _vm->_buttonStyle.getTextOffset(hasFocus, pressed);
AgiTextColor color = _vm->_buttonStyle.getColor(hasFocus, pressed, positive);
bool border = _vm->_buttonStyle.getBorder(hasFocus, pressed);
rawDrawButton(x, y, label, color.fg, color.bg, border, textOffset);
}
void GfxMgr::rawDrawButton(int x, int y, const char *s, int fgcolor, int bgcolor, bool border, int textOffset) {
int len = strlen(s);
int x1, y1, x2, y2;

View File

@ -78,6 +78,7 @@ public:
void clearConsoleScreen(int);
void drawBox(int, int, int, int, int, int, int);
void drawDefaultStyleButton(int, int, const char *, int, int, int fgcolor = 0, int bgcolor = 0);
void drawCurrentStyleButton(int x, int y, const char *label, bool hasFocus, bool pressed = false, bool positive = true);
int testButton(int, int, const char *);
void drawRectangle(int, int, int, int, int);
void saveBlock(int, int, int, int, uint8 *);

View File

@ -516,7 +516,7 @@ int AgiEngine::selectSlot() {
buttonY = (vm + 17) * CHAR_LINES;
for (i = 0; i < 2; i++)
_gfx->drawDefaultStyleButton(buttonX[i], buttonY, buttonText[i], 0, 0, MSG_BOX_TEXT, MSG_BOX_COLOUR);
_gfx->drawCurrentStyleButton(buttonX[i], buttonY, buttonText[i], false, false, i == 0);
AllowSyntheticEvents on(this);
int oldFirstSlot = _firstSlot + 1;

View File

@ -364,7 +364,7 @@ int AgiEngine::selectionBox(const char *m, const char **b) {
debugC(4, kDebugLevelText, "waiting...");
for (;;) {
for (i = 0; b[i]; i++)
_gfx->drawDefaultStyleButton(bx[i], by[i], b[i], i == active, 0, MSG_BOX_TEXT, MSG_BOX_COLOUR);
_gfx->drawCurrentStyleButton(bx[i], by[i], b[i], i == active, false, i == 0);
_gfx->pollTimer(); /* msdos driver -> does nothing */
key = doPollKeyboard();