aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/systemui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agi/systemui.cpp')
-rw-r--r--engines/agi/systemui.cpp101
1 files changed, 57 insertions, 44 deletions
diff --git a/engines/agi/systemui.cpp b/engines/agi/systemui.cpp
index f618459823..7aa26131c9 100644
--- a/engines/agi/systemui.cpp
+++ b/engines/agi/systemui.cpp
@@ -751,21 +751,23 @@ bool SystemUI::askForVerification(const char *verifyText, const char *button1Tex
// Buttons enabled, calculate button coordinates
int16 msgBoxX = 0, msgBoxY = 0, msgBoxLowerY = 0;
int16 msgBoxWidth = 0, msgBoxHeight = 0;
+ int16 fontHeight = _gfx->getDisplayFontHeight();
+ int16 fontWidth = _gfx->getDisplayFontWidth();
_text->getMessageBoxInnerDisplayDimensions(msgBoxX, msgBoxY, msgBoxWidth, msgBoxHeight);
- // Adjust Y coordinate to lower edge
+ // Calculate lower Y
msgBoxLowerY = msgBoxY + (msgBoxHeight - 1);
buttonEntry.active = false;
if (button1Text) {
buttonEntry.text = button1Text;
- buttonEntry.textWidth = strlen(button1Text) * FONT_DISPLAY_WIDTH;
+ buttonEntry.textWidth = strlen(button1Text) * _gfx->getDisplayFontWidth();
buttonEntry.isDefault = true;
_buttonArray.push_back(buttonEntry);
}
if (button2Text) {
buttonEntry.text = button2Text;
- buttonEntry.textWidth = strlen(button2Text) * FONT_DISPLAY_WIDTH;
+ buttonEntry.textWidth = strlen(button2Text) * _gfx->getDisplayFontWidth();
buttonEntry.isDefault = false;
_buttonArray.push_back(buttonEntry);
}
@@ -773,37 +775,30 @@ bool SystemUI::askForVerification(const char *verifyText, const char *button1Tex
// Render-Mode specific calculations
switch (_vm->_renderMode) {
case Common::kRenderApple2GS:
- _buttonArray[0].rect = Common::Rect(14 + _buttonArray[0].textWidth, FONT_DISPLAY_HEIGHT + 6);
- _buttonArray[0].rect.moveTo(msgBoxX + 2, msgBoxLowerY - (8 + FONT_DISPLAY_HEIGHT + 2));
-
+ _buttonArray[0].rect = createRect(msgBoxX, +2, msgBoxLowerY - fontHeight, -(8 + 2), _buttonArray[0].textWidth, +14, fontHeight, +6);
+
if (_buttonArray.size() > 1) {
- int16 adjustedX = msgBoxX + msgBoxWidth - 10;
- _buttonArray[1].rect = Common::Rect(14 + _buttonArray[1].textWidth, FONT_DISPLAY_HEIGHT + 6);
- adjustedX -= _buttonArray[1].rect.width();
- _buttonArray[1].rect.moveTo(adjustedX, msgBoxLowerY - (8 + FONT_DISPLAY_HEIGHT + 2));
+ int16 adjustedX = msgBoxX + msgBoxWidth - _buttonArray[1].textWidth; // - 10;
+ _buttonArray[1].rect = createRect(adjustedX, -(14 + 10), _buttonArray[0].rect.top, 0, _buttonArray[1].textWidth, +14, fontHeight, +6);
}
break;
- case Common::kRenderAmiga:
- _buttonArray[0].rect = Common::Rect(4 + _buttonArray[0].textWidth + 4, 2 + FONT_DISPLAY_HEIGHT + 2);
- _buttonArray[0].rect.moveTo(msgBoxX, msgBoxLowerY - _buttonArray[0].rect.height());
+ case Common::kRenderAmiga: {
+ _buttonArray[0].rect = createRect(msgBoxX, 0, msgBoxLowerY - fontHeight, -(2 + 2), _buttonArray[0].textWidth, +(4 + 4), fontHeight, +(2 + 2));
if (_buttonArray.size() > 1) {
- int16 adjustedX = msgBoxX + msgBoxWidth;
- _buttonArray[1].rect = Common::Rect(4 + _buttonArray[1].textWidth + 4, 2 + FONT_DISPLAY_HEIGHT + 2);
- adjustedX -= _buttonArray[1].rect.width();
- _buttonArray[1].rect.moveTo(adjustedX, msgBoxLowerY - _buttonArray[1].rect.height());
+ int16 adjustedX = msgBoxX + msgBoxWidth - _buttonArray[1].textWidth;
+ _buttonArray[1].rect = createRect(adjustedX, -(4 + 4), _buttonArray[0].rect.top, 0, _buttonArray[1].textWidth, +(4 + 4), fontHeight, +(2 + 2));
}
break;
+ }
case Common::kRenderAtariST:
- _buttonArray[0].rect = Common::Rect(_buttonArray[0].textWidth, FONT_DISPLAY_HEIGHT);
- _buttonArray[0].rect.moveTo(msgBoxX + (5 * FONT_DISPLAY_WIDTH), msgBoxLowerY - FONT_DISPLAY_HEIGHT);
+ _buttonArray[0].rect = createRect(msgBoxX + (5 * fontWidth), 0, msgBoxLowerY - fontHeight, 0, _buttonArray[0].textWidth, 0, fontHeight, 0);
+
if (_buttonArray.size() > 1) {
- int16 adjustedX = msgBoxX + msgBoxWidth - (5 * FONT_DISPLAY_WIDTH);
- _buttonArray[1].rect = Common::Rect(_buttonArray[1].textWidth, FONT_DISPLAY_HEIGHT);
- adjustedX -= _buttonArray[1].rect.width();
- _buttonArray[1].rect.moveTo(adjustedX, msgBoxLowerY - _buttonArray[1].rect.height());
+ int16 adjustedX = msgBoxX + msgBoxWidth - (5 * fontWidth + _buttonArray[1].textWidth);
+ _buttonArray[1].rect = createRect(adjustedX, 0, _buttonArray[0].rect.top, 0, _buttonArray[1].textWidth, 0, fontHeight, 0);
}
break;
@@ -951,6 +946,25 @@ void SystemUI::askForVerificationKeyPress(uint16 newKey) {
}
}
+Common::Rect SystemUI::createRect(int16 x, int16 adjX, int16 y, int16 adjY, int16 width, int16 adjWidth, int16 height, int16 adjHeight) {
+ switch (_gfx->getUpscaledHires()) {
+ case DISPLAY_UPSCALED_DISABLED:
+ break;
+ case DISPLAY_UPSCALED_640x400:
+ adjX *= 2; adjY *= 2;
+ adjWidth *= 2; adjHeight *= 2;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ x += adjX; y += adjY;
+ width += adjWidth; height += adjHeight;
+ Common::Rect newRect(width, height);
+ newRect.moveTo(x, y);
+ return newRect;
+}
+
#define SYSTEMUI_BUTTONEDGE_APPLEIIGS_WIDTH 8
#define SYSTEMUI_BUTTONEDGE_APPLEIIGS_HEIGHT 5
@@ -998,20 +1012,20 @@ void SystemUI::drawButtonAppleIIgs(SystemUIButtonEntry *button) {
}
// draw base box for it
- _gfx->drawDisplayRect(button->rect.left, button->rect.bottom - 1, button->rect.width(), button->rect.height(), backgroundColor, false);
+ _gfx->drawDisplayRect(button->rect.left, button->rect.top, button->rect.width(), button->rect.height(), backgroundColor, false);
// draw inner lines
- _gfx->drawDisplayRect(button->rect.left + 1, button->rect.top - 1, button->rect.width() - 2, 1, 0, false); // upper horizontal
- _gfx->drawDisplayRect(button->rect.left - 2, button->rect.bottom - 2, 2, button->rect.height() - 2, 0, false); // left vertical
- _gfx->drawDisplayRect(button->rect.right, button->rect.bottom - 2, 2, button->rect.height() - 2, 0, false); // right vertical
- _gfx->drawDisplayRect(button->rect.left + 1, button->rect.bottom, button->rect.width() - 2, 1, 0, false); // lower horizontal
+ _gfx->drawDisplayRect(button->rect.left, +1, button->rect.top, -1, button->rect.width(), -2, 0, 1, 0, false); // lower horizontal
+ _gfx->drawDisplayRect(button->rect.left, -2, button->rect.top, +1, 0, 2, button->rect.height(), -2, 0, false); // left vertical
+ _gfx->drawDisplayRect(button->rect.right, 0, button->rect.top, +1, 0, 2, button->rect.height(), -2, 0, false); // right vertical
+ _gfx->drawDisplayRect(button->rect.left, +1, button->rect.bottom, 0, button->rect.width(), -2, 0, 1, 0, false); // upper horizontal
if (button->isDefault) {
// draw outer lines
- _gfx->drawDisplayRect(button->rect.left, button->rect.top - 3, button->rect.width(), 1, 0, false); // upper horizontal
- _gfx->drawDisplayRect(button->rect.left - 5, button->rect.bottom - 2, 2, button->rect.height() - 2, 0, false); // left vertical
- _gfx->drawDisplayRect(button->rect.right + 3, button->rect.bottom - 2, 2, button->rect.height() - 2, 0, false); // right vertical
- _gfx->drawDisplayRect(button->rect.left, button->rect.bottom + 2, button->rect.width(), 1, 0, false); // lower horizontal
+ _gfx->drawDisplayRect(button->rect.left, 0, button->rect.top, -3, button->rect.width(), 0, 0, 1, 0, false); // upper horizontal
+ _gfx->drawDisplayRect(button->rect.left, -5, button->rect.top, +2, 0, 2, button->rect.height(), -2, 0, false); // left vertical
+ _gfx->drawDisplayRect(button->rect.right, +3, button->rect.top, +2, 0, 2, button->rect.height(), -2, 0, false); // right vertical
+ _gfx->drawDisplayRect(button->rect.left, 0, button->rect.bottom, +2, button->rect.width(), 0, 0, 1, 0, false); // lower horizontal
if (button->active)
edgeBitmap = buttonEdgeAppleIIgsDefaultActive;
@@ -1026,18 +1040,18 @@ void SystemUI::drawButtonAppleIIgs(SystemUIButtonEntry *button) {
}
// draw edge graphics
- drawButtonAppleIIgsEdgePixels(button->rect.left - 5, button->rect.top - 3, edgeBitmap, false, false);
- drawButtonAppleIIgsEdgePixels(button->rect.right + 4, button->rect.top - 3, edgeBitmap, true, false);
- drawButtonAppleIIgsEdgePixels(button->rect.left - 5, button->rect.bottom + 2, edgeBitmap, false, true);
- drawButtonAppleIIgsEdgePixels(button->rect.right + 4, button->rect.bottom + 2, edgeBitmap, true, true);
+ drawButtonAppleIIgsEdgePixels(button->rect.left, -5, button->rect.top, -3, edgeBitmap, false, false);
+ drawButtonAppleIIgsEdgePixels(button->rect.right, +4, button->rect.top, -3, edgeBitmap, true, false);
+ drawButtonAppleIIgsEdgePixels(button->rect.left, -5, button->rect.bottom, +2, edgeBitmap, false, true);
+ drawButtonAppleIIgsEdgePixels(button->rect.right, +4, button->rect.bottom, +2, edgeBitmap, true, true);
// Button text
- _gfx->drawStringOnDisplay(button->rect.left + 7, button->rect.top + 3, button->text, foregroundColor, backgroundColor);
+ _gfx->drawStringOnDisplay(button->rect.left, +7, button->rect.top, +3, button->text, foregroundColor, backgroundColor);
- _gfx->copyDisplayRectToScreen(button->rect.left - 5, button->rect.top - 3, button->rect.width() + 10, button->rect.height() + 6);
+ _gfx->copyDisplayRectToScreen(button->rect.left, -5, button->rect.top, -3, button->rect.width(), +10, button->rect.height(), +6);
}
-void SystemUI::drawButtonAppleIIgsEdgePixels(int16 x, int16 y, byte *edgeBitmap, bool mirrored, bool upsideDown) {
+void SystemUI::drawButtonAppleIIgsEdgePixels(int16 x, int16 adjX, int16 y, int16 adjY, byte *edgeBitmap, bool mirrored, bool upsideDown) {
int8 directionY = upsideDown ? -1 : +1;
int8 directionX = mirrored ? -1 : +1;
int8 curY = 0;
@@ -1055,9 +1069,9 @@ void SystemUI::drawButtonAppleIIgsEdgePixels(int16 x, int16 y, byte *edgeBitmap,
while (widthLeft) {
if (curBitmapByte & curBitmapBit) {
- _gfx->putPixelOnDisplay(x + curX, y + curY, 0);
+ _gfx->putPixelOnDisplay(x, adjX + curX, y, adjY + curY, 0);
} else {
- _gfx->putPixelOnDisplay(x + curX, y + curY, 15);
+ _gfx->putPixelOnDisplay(x, adjX + curX, y, adjY + curY, 15);
}
curBitmapBit = curBitmapBit >> 1;
@@ -1092,12 +1106,11 @@ void SystemUI::drawButtonAmiga(SystemUIButtonEntry *button) {
}
// draw base box for it
- _gfx->drawDisplayRect(button->rect.left, button->rect.bottom - 1, button->rect.width(), button->rect.height(), backgroundColor, false);
+ _gfx->drawDisplayRect(button->rect.left, button->rect.top, button->rect.width(), button->rect.height(), backgroundColor, false);
// Button text
- _gfx->drawStringOnDisplay(button->rect.left + 4, button->rect.top + 2, button->text, foregroundColor, backgroundColor);
+ _gfx->drawStringOnDisplay(button->rect.left, +4, button->rect.top, +2, button->text, foregroundColor, backgroundColor);
- // draw base box for it
_gfx->copyDisplayRectToScreen(button->rect.left, button->rect.top, button->rect.width(), button->rect.height());
}