[Scummvm-cvs-logs] CVS: scummvm/scumm dialogs.cpp,1.138,1.139 help.cpp,1.20,1.21

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Mon May 16 23:22:06 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26100

Modified Files:
	dialogs.cpp help.cpp 
Log Message:
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.


Index: dialogs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- dialogs.cpp	16 May 2005 12:26:44 -0000	1.138
+++ dialogs.cpp	17 May 2005 06:20:50 -0000	1.139
@@ -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 @@
 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();
 }
 

Index: help.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/help.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- help.cpp	16 May 2005 14:41:41 -0000	1.20
+++ help.cpp	17 May 2005 06:20:50 -0000	1.21
@@ -103,10 +103,12 @@
 		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)





More information about the Scummvm-git-logs mailing list