[Scummvm-cvs-logs] CVS: scummvm/gui about.cpp,1.23,1.24 newgui.cpp,1.97,1.98 newgui.h,1.52,1.53 widget.cpp,1.40,1.41

Max Horn fingolfin at users.sourceforge.net
Thu Jan 6 14:49:29 CET 2005


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

Modified Files:
	about.cpp newgui.cpp newgui.h widget.cpp 
Log Message:
Switching GUI to an alternate font; using a second, bigger, font for 640x480 games like COMI. Note: we can always easily switch back to the SCUMM font or any other font, if we want to

Index: about.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/about.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- about.cpp	1 Jan 2005 16:09:06 -0000	1.23
+++ about.cpp	6 Jan 2005 22:48:41 -0000	1.24
@@ -86,7 +86,7 @@
 	
 	int i;
 	
-	_lineHeight = g_gui.getFont().getFontHeight() + 3;
+	_lineHeight = g_gui.getFontHeight() + 3;
 
 	for (i = 0; i < 1; i++)
 		_lines.push_back("");

Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.cpp,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- newgui.cpp	6 Jan 2005 21:46:21 -0000	1.97
+++ newgui.cpp	6 Jan 2005 22:48:42 -0000	1.98
@@ -86,8 +86,11 @@
 
 	_scaleFactor = MIN(_system->getWidth() / kDefaultGUIWidth, _system->getHeight() / kDefaultGUIHeight);
 
-	// TODO: Pick a bigger font depending on the 'scale' factor.
-	_font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
+	// Pick the font depending on the scale factor.
+	if (_scaleFactor == 1)
+		_font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
+	else
+		_font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
 }
 
 void NewGui::runLoop() {
@@ -349,19 +352,23 @@
 void NewGui::drawChar(byte chr, int xx, int yy, OverlayColor color, const Graphics::Font *font) {
 	if (font == 0)
 		font = &getFont();
-	font->drawChar(&_screen, chr, xx, yy, color, _scaleFactor);
+	font->drawChar(&_screen, chr, xx * _scaleFactor, yy * _scaleFactor, color);
 }
 
-int NewGui::getStringWidth(const String &str) {
-	return getFont().getStringWidth(str);
+int NewGui::getStringWidth(const String &str) const {
+	return getFont().getStringWidth(str) / _scaleFactor;
 }
 
-int NewGui::getCharWidth(byte c) {
-	return getFont().getCharWidth(c);
+int NewGui::getCharWidth(byte c) const {
+	return getFont().getCharWidth(c) / _scaleFactor;
+}
+
+int NewGui::getFontHeight() const {
+	return getFont().getFontHeight() / _scaleFactor;
 }
 
 void NewGui::drawString(const String &s, int x, int y, int w, OverlayColor color, TextAlignment align, int deltax, bool useEllipsis) {
-	getFont().drawString(&_screen, s, x, y, w, color, align, deltax, useEllipsis, _scaleFactor);
+	getFont().drawString(&_screen, s, x * _scaleFactor, y * _scaleFactor, w * _scaleFactor, color, align, deltax, useEllipsis);
 }
 
 //

Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- newgui.h	6 Jan 2005 21:15:52 -0000	1.52
+++ newgui.h	6 Jan 2005 22:48:42 -0000	1.53
@@ -36,7 +36,7 @@
 
 
 // Height of a single text line
-#define kLineHeight	(g_gui.getFont().getFontHeight() + 2)
+#define kLineHeight	(g_gui.getFontHeight() + 2)
 
 
 using Graphics::TextAlignment;
@@ -64,9 +64,9 @@
 	// until no dialogs are active anymore.
 	void runLoop();
 
-	bool isActive()	{ return ! _dialogStack.empty(); }
+	bool isActive() const	{ return ! _dialogStack.empty(); }
 
-	int getScaleFactor() { return _scaleFactor; }
+	int getScaleFactor() const { return _scaleFactor; }
 	void enableScaling(bool enable) { _scaleEnable = enable; updateScaleFactor(); }
 
 protected:
@@ -140,8 +140,9 @@
 	void drawChar(byte c, int x, int y, OverlayColor color, const Graphics::Font *font = 0);
 	void drawString(const String &str, int x, int y, int w, OverlayColor color, Graphics::TextAlignment align = Graphics::kTextAlignLeft, int deltax = 0, bool useEllipsis = true);
 
-	int getStringWidth(const String &str);
-	int getCharWidth(byte c);
+	int getStringWidth(const String &str) const;
+	int getCharWidth(byte c) const;
+	int getFontHeight() const;
 
 	void drawBitmap(uint32 *bitmap, int x, int y, OverlayColor color, int h = 8);
 

Index: widget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- widget.cpp	1 Jan 2005 16:09:07 -0000	1.40
+++ widget.cpp	6 Jan 2005 22:48:42 -0000	1.41
@@ -186,12 +186,11 @@
 
 	// Draw the box
 	gui->box(_x, _y, 14, 14, gui->_color, gui->_shadowcolor);
+	gui->fillRect(_x + 2, _y + 2, 10, 10, gui->_bgcolor);
 
 	// If checked, draw cross inside the box
 	if (_state)
-		gui->drawBitmap(checked_img, _x + 3, _y + 3, isEnabled() ? gui->_textcolor : gui->_color);
-	else
-		gui->fillRect(_x + 2, _y + 2, 10, 10, gui->_bgcolor);
+		gui->drawBitmap(checked_img, _x + 4, _y + 3, isEnabled() ? gui->_textcolor : gui->_color);
 
 	// Finally draw the label
 	gui->drawString(_label, _x + 20, _y + 3, _w, isEnabled() ? gui->_textcolor : gui->_color);





More information about the Scummvm-git-logs mailing list