diff options
Diffstat (limited to 'engines/agi')
-rw-r--r-- | engines/agi/graphics.cpp | 18 | ||||
-rw-r--r-- | engines/agi/graphics.h | 1 | ||||
-rw-r--r-- | engines/agi/saveload.cpp | 2 | ||||
-rw-r--r-- | engines/agi/text.cpp | 2 |
4 files changed, 21 insertions, 2 deletions
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp index c7b62ee11f..af57209357 100644 --- a/engines/agi/graphics.cpp +++ b/engines/agi/graphics.cpp @@ -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; diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h index e9f16a63ef..d76a2e1397 100644 --- a/engines/agi/graphics.h +++ b/engines/agi/graphics.h @@ -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 *); diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index 0f475ab644..70096bddc2 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -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; diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp index 7ba7aa71fc..560e9b6f34 100644 --- a/engines/agi/text.cpp +++ b/engines/agi/text.cpp @@ -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(); |