From 8eee14934b7bcba1a6de1a0f5228e9c7adc9ca1b Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 16 May 2005 12:26:44 +0000 Subject: Made InfoDialog scale itself. svn-id: r18128 --- scumm/dialogs.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index 4daf9fe991..3bcc014403 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -727,12 +727,28 @@ InfoDialog::InfoDialog(ScummEngine *scumm, const String& message) } void InfoDialog::setInfoText(const String& message) { - int width = g_gui.getStringWidth(message) + 16; + const int screenW = g_system->getOverlayWidth(); + const int screenH = g_system->getOverlayHeight(); + const Graphics::Font *font; + GUI::WidgetSize ws; + + if (screenW >= 400 && screenH >= 300) { + ws = GUI::kBigWidgetSize; + font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont); + } else { + ws = GUI::kNormalWidgetSize; + font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont); + } + + int width = font->getStringWidth(message) + 16; + int height = font->getFontHeight() + 8; - _x = (320 - width) / 2; _w = width; + _h = height; + _x = (screenW - width) / 2; + _y = (screenH - height) / 2; - new StaticTextWidget(this, 4, 4, _w - 8, _h, message, kTextAlignCenter); + new StaticTextWidget(this, 4, 4, _w - 8, _h, message, kTextAlignCenter, ws); } #pragma mark - -- cgit v1.2.3