diff options
author | Torbjörn Andersson | 2005-05-17 06:20:50 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2005-05-17 06:20:50 +0000 |
commit | 8feee31884c2258befadc57f21429572c751b978 (patch) | |
tree | 48a31acb4a66b42dac8ed1983f375db5c81bac26 | |
parent | 4ecb6d650f54bc0f7f46d32b685f6abe599f3fbd (diff) | |
download | scummvm-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
-rw-r--r-- | scumm/dialogs.cpp | 52 | ||||
-rw-r--r-- | scumm/help.cpp | 8 |
2 files changed, 48 insertions, 12 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(); } diff --git a/scumm/help.cpp b/scumm/help.cpp index fce43b0c16..9d690841ca 100644 --- a/scumm/help.cpp +++ b/scumm/help.cpp @@ -103,10 +103,12 @@ void ScummHelp::updateStrings(byte gameId, byte version, int page, ADD_BIND("Ctrl Alt a", "Toggle aspect-ratio correction"); ADD_LINE; ADD_LINE; + // FIXME: This should use word-wrapping, and should not assume + // that the font is mono-spaced. ADD_TEXT("* Note that using ctrl-f and"); - ADD_TEXT(" ctrl-g are not recommended"); - ADD_TEXT(" since they may cause crashes"); - ADD_TEXT(" or incorrect game behaviour."); + ADD_TEXT(" ctrl-g are not recommended"); + ADD_TEXT(" since they may cause crashes"); + ADD_TEXT(" or incorrect game behaviour."); break; case 3: if (gameId == GID_LOOM || gameId == GID_LOOM256) |