[Scummvm-cvs-logs] CVS: scummvm newgui.cpp,1.18,1.19 newgui.h,1.13,1.14

Max Horn fingolfin at users.sourceforge.net
Mon Jul 15 06:00:05 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv7183

Modified Files:
	newgui.cpp newgui.h 
Log Message:
allow static text/button widgets in NewGUI to be drawn centred

Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- newgui.cpp	13 Jul 2002 22:41:28 -0000	1.18
+++ newgui.cpp	15 Jul 2002 12:59:56 -0000	1.19
@@ -401,23 +401,25 @@
 
 }
 
-void NewGui::drawString(const char *str, int x, int y, int w, byte color)
+void NewGui::drawString(const char *str, int x, int y, int w, byte color, bool center)
 {
-	StringTab *st = &_s->string[5];
-	st->charset = 1;
-	st->center = false;
-	st->color = color;
-	st->xpos = x;
-	st->ypos = y;
-	st->right = x + w;
-
 	if (_s->_gameId) {						/* If a game is active.. */
+		StringTab *st = &_s->string[5];
+		st->charset = 1;
+		st->center = center;
+		st->color = color;
+		st->xpos = center ? x+w/2 : x;
+		st->ypos = y;
+		st->right = x + w;
+	
 		_s->_messagePtr = (byte *)str;
 		_s->drawString(5);
 	} else {
+		// FIXME - support center, use nicer custom font. Ultimately, we might
+		// want to *always* draw our messages this way.
 		uint len = strlen(str);
 		for (uint letter = 0; letter < len; letter++)
-			drawChar(str[letter], st->xpos + (letter * 8), st->ypos);
+			drawChar(str[letter], x + (letter * 8), y);
 	}
 }
 

Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- newgui.h	13 Jul 2002 22:41:28 -0000	1.13
+++ newgui.h	15 Jul 2002 12:59:56 -0000	1.14
@@ -133,7 +133,7 @@
 	void frameRect(int x, int y, int w, int h, byte color);
 	void addDirtyRect(int x, int y, int w, int h);
 	void drawChar(const char c, int x, int y);
-	void drawString(const char *str, int x, int y, int w, byte color);
+	void drawString(const char *str, int x, int y, int w, byte color, bool center = false);
 
 	void drawBitmap(uint32 bitmap[8], int x, int y, byte color);
 	void blitTo(byte buffer[320*200], int x, int y, int w, int h);





More information about the Scummvm-git-logs mailing list