aboutsummaryrefslogtreecommitdiff
path: root/scumm/dialogs.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-05-17 06:20:50 +0000
committerTorbjörn Andersson2005-05-17 06:20:50 +0000
commit8feee31884c2258befadc57f21429572c751b978 (patch)
tree48a31acb4a66b42dac8ed1983f375db5c81bac26 /scumm/dialogs.cpp
parent4ecb6d650f54bc0f7f46d32b685f6abe599f3fbd (diff)
downloadscummvm-rg350-8feee31884c2258befadc57f21429572c751b978.tar.gz
scummvm-rg350-8feee31884c2258befadc57f21429572c751b978.tar.bz2
scummvm-rg350-8feee31884c2258befadc57f21429572c751b978.zip
Made the help dialog scale itself. There's one place where it ought to use
word-wrapping, but it looks fairly good even with the current hard-coded line breaks. svn-id: r18135
Diffstat (limited to 'scumm/dialogs.cpp')
-rw-r--r--scumm/dialogs.cpp52
1 files changed, 43 insertions, 9 deletions
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp
index 3bcc014403..aa53d599e3 100644
--- a/scumm/dialogs.cpp
+++ b/scumm/dialogs.cpp
@@ -50,6 +50,7 @@
using GUI::CommandSender;
using GUI::StaticTextWidget;
using GUI::kButtonWidth;
+using GUI::kButtonHeight;
using GUI::kBigButtonWidth;
using GUI::kBigButtonHeight;
using GUI::kCloseCmd;
@@ -649,20 +650,53 @@ enum {
HelpDialog::HelpDialog(ScummEngine *scumm)
: ScummDialog(scumm, 5, 5, 310, 190) {
- _page = 1;
- _numPages = ScummHelp::numPages(scumm->_gameId);
+ const int screenW = g_system->getOverlayWidth();
+ const int screenH = g_system->getOverlayHeight();
+ const Graphics::Font *font;
- _prevButton = addButton(10, 170, "Previous", kPrevCmd, 'P');
- _nextButton = addButton(90, 170, "Next", kNextCmd, 'N');
- addButton(210, 170, "Close", kCloseCmd, 'C');
- _prevButton->clearFlags(WIDGET_ENABLED);
+ GUI::WidgetSize ws;
+ int buttonHeight;
+ int buttonWidth;
+ int lineHeight;
+
+ if (screenW >= 400 && screenH >= 300) {
+ ws = GUI::kBigWidgetSize;
+ buttonHeight = kBigButtonHeight;
+ buttonWidth = kBigButtonWidth;
+ _w = 370;
+ _x = (screenW - _w) / 2;
+ font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
+ lineHeight = font->getFontHeight();
+ } else {
+ ws = GUI::kNormalWidgetSize;
+ buttonHeight = kButtonHeight;
+ buttonWidth = kButtonWidth;
+ _x = 5;
+ _w = screenW - 2 * 5;
+ font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
+ lineHeight = font->getFontHeight();
+ }
+
+ _h = 5 + (2 + HELP_NUM_LINES) * lineHeight + buttonHeight + 7;
+ _y = (screenH - _h) / 2;
+
+ _title = new StaticTextWidget(this, 10, 5, _w, lineHeight, "", kTextAlignCenter, ws);
- _title = new StaticTextWidget(this, 10, 5, 290, 16, "", kTextAlignCenter);
for (int i = 0; i < HELP_NUM_LINES; i++) {
- _key[i] = new StaticTextWidget(this, 10, 18 + (10 * i), 80, 16, "", kTextAlignLeft);
- _dsc[i] = new StaticTextWidget(this, 90, 18 + (10 * i), 210, 16, "", kTextAlignLeft);
+ _key[i] = new StaticTextWidget(this, 10, 5 + lineHeight * (i + 2), 80, lineHeight, "", kTextAlignLeft, ws);
+ _dsc[i] = new StaticTextWidget(this, 90, 5 + lineHeight * (i + 2), _w - 10 - 90, lineHeight, "", kTextAlignLeft, ws);
}
+ _page = 1;
+ _numPages = ScummHelp::numPages(scumm->_gameId);
+
+ int y = 5 + lineHeight * (HELP_NUM_LINES + 2) + 2;
+
+ _prevButton = addButton(10, y, "Previous", kPrevCmd, 'P', ws);
+ _nextButton = addButton(10 + buttonWidth + 8, y, "Next", kNextCmd, 'N', ws);
+ addButton(_w - 8 - buttonWidth, y, "Close", kCloseCmd, 'C', ws);
+ _prevButton->clearFlags(WIDGET_ENABLED);
+
displayKeyBindings();
}