Made the SCUMM main dialog scale itself

svn-id: r18097
This commit is contained in:
Max Horn 2005-05-14 22:47:00 +00:00
parent 9b9e8424c1
commit ef8c36554c
2 changed files with 47 additions and 14 deletions

View File

@ -383,37 +383,67 @@ Common::StringList generateSavegameList(ScummEngine *scumm, bool saveMode) {
return l;
}
enum {
kRowHeight = 18,
kBigButtonWidth = 90,
kMainMenuWidth = (kBigButtonWidth + 2 * 8),
kMainMenuHeight = 7 * kRowHeight + 3 * 5 + 7 + 5
};
#define addBigButton(label, cmd, hotkey) \
new GUI::ButtonWidget(this, x, y, kBigButtonWidth, 16, label, cmd, hotkey); y += kRowHeight
new GUI::ButtonWidget(this, hOffset, y, buttonWidth, buttonHeight, label, cmd, hotkey, ws); \
y += (buttonHeight + vAddOff)
MainMenuDialog::MainMenuDialog(ScummEngine *scumm)
: ScummDialog(scumm, (320 - kMainMenuWidth) / 2, (200 - kMainMenuHeight)/2, kMainMenuWidth, kMainMenuHeight) {
int y = 7;
: ScummDialog(scumm, 0, 0, 0, 0) {
const int sw = g_system->getOverlayWidth();
const int sh = g_system->getOverlayHeight();
int hOffset;
int vSpace;
int vAddOff;
GUI::WidgetSize ws;
int buttonWidth;
int buttonHeight;
if (sw >= 400 && sh >= 300) {
buttonWidth = 160;
buttonHeight = 28;
ws = GUI::kBigWidgetSize;
hOffset = 12;
vSpace = 7;
vAddOff = 3;
} else {
buttonWidth = 90;
buttonHeight = 16;
ws = GUI::kNormalWidgetSize;
hOffset = 8;
vSpace = 5;
vAddOff = 2;
}
int y = vSpace + vAddOff;
const int x = (_w - kBigButtonWidth) / 2;
addBigButton("Resume", kPlayCmd, 'P');
y += 5;
y += vSpace;
addBigButton("Load", kLoadCmd, 'L');
addBigButton("Save", kSaveCmd, 'S');
y += 5;
y += vSpace;
addBigButton("Options", kOptionsCmd, 'O');
#ifndef DISABLE_HELP
addBigButton("Help", kHelpCmd, 'H');
#endif
addBigButton("About", kAboutCmd, 'A');
y += 5;
y += vSpace;
addBigButton("Quit", kQuitCmd, 'Q');
_w = buttonWidth + 2 * hOffset;
_h = y + vSpace;
_x = (sw - _w) / 2;
_y = (sh - _h) / 2;
//
// Create the sub dialog(s)
//

View File

@ -72,6 +72,9 @@ public:
~MainMenuDialog();
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
// disable scaling
bool wantsScaling() const { return false; }
protected:
GUI::Dialog *_aboutDialog;
GUI::Dialog *_optionsDialog;