[Scummvm-cvs-logs] CVS: scummvm/scumm dialogs.cpp,1.137,1.138

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Mon May 16 12:48:27 CEST 2005


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

Modified Files:
	dialogs.cpp 
Log Message:
Made InfoDialog scale itself.


Index: dialogs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -d -r1.137 -r1.138
--- dialogs.cpp	16 May 2005 00:38:30 -0000	1.137
+++ dialogs.cpp	16 May 2005 12:26:44 -0000	1.138
@@ -727,12 +727,28 @@
 }
 
 void InfoDialog::setInfoText(const String& message) {
-	int width = g_gui.getStringWidth(message) + 16;
+	const int screenW = g_system->getOverlayWidth();
+	const int screenH = g_system->getOverlayHeight();
+	const Graphics::Font *font;
+	GUI::WidgetSize ws;
+
+	if (screenW >= 400 && screenH >= 300) {
+		ws = GUI::kBigWidgetSize;
+		font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
+	} else {
+		ws = GUI::kNormalWidgetSize;
+		font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
+	}
+
+	int width = font->getStringWidth(message) + 16;
+	int height = font->getFontHeight() + 8;
 
-	_x = (320 - width) / 2;
 	_w = width;
+	_h = height;
+	_x = (screenW - width) / 2;
+	_y = (screenH - height) / 2;
 
-	new StaticTextWidget(this, 4, 4, _w - 8, _h, message, kTextAlignCenter);
+	new StaticTextWidget(this, 4, 4, _w - 8, _h, message, kTextAlignCenter, ws);
 }
 
 #pragma mark -





More information about the Scummvm-git-logs mailing list