[Scummvm-cvs-logs] CVS: scummvm/scumm dialogs.cpp,1.133,1.134 dialogs.h,1.50,1.51
Max Horn
fingolfin at users.sourceforge.net
Sat May 14 15:47:45 CEST 2005
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29215
Modified Files:
dialogs.cpp dialogs.h
Log Message:
Made the SCUMM main dialog scale itself
Index: dialogs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- dialogs.cpp 11 May 2005 19:32:18 -0000 1.133
+++ dialogs.cpp 14 May 2005 22:46:59 -0000 1.134
@@ -383,37 +383,67 @@
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)
//
Index: dialogs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- dialogs.h 11 May 2005 18:14:23 -0000 1.50
+++ dialogs.h 14 May 2005 22:47:00 -0000 1.51
@@ -72,6 +72,9 @@
~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;
More information about the Scummvm-git-logs
mailing list