[Scummvm-cvs-logs] CVS: scummvm newgui.cpp,1.5,1.6 newgui.h,1.5,1.6

Max Horn fingolfin at users.sourceforge.net
Sun Jul 7 16:38:04 CEST 2002


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

Modified Files:
	newgui.cpp newgui.h 
Log Message:
added CheckboxWidget; added NewGui::drawBitmap

Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- newgui.cpp	7 Jul 2002 22:44:29 -0000	1.5
+++ newgui.cpp	7 Jul 2002 23:37:47 -0000	1.6
@@ -179,11 +179,14 @@
 	return string_map_table_custom[stringno];
 }
 
+
 #pragma mark -
 
-byte *NewGui::getBasePtr(int x, int y)
+
+byte *NewGui::getBasePtr(int x, int y, VirtScreen *vs)
 {
-	VirtScreen *vs = _s->findVirtScreen(y);
+	if (vs == NULL)
+		vs = _s->findVirtScreen(y);
 
 	if (vs == NULL)
 		return NULL;
@@ -237,7 +240,7 @@
 void NewGui::clearArea(int x, int y, int w, int h)
 {
 	VirtScreen *vs = _s->findVirtScreen(y);
-	byte *ptr = getBasePtr(x, y);
+	byte *ptr = getBasePtr(x, y, vs);
 	if (ptr == NULL)
 		return;
 
@@ -280,6 +283,7 @@
 	_color = tempc;
 
 }
+
 void NewGui::drawString(const char *str, int x, int y, int w, byte color)
 {
 	StringTab *st = &_s->string[5];
@@ -298,4 +302,27 @@
 		for (uint letter = 0; letter < len; letter++)
 			drawChar(str[letter], st->xpos + (letter * 8), st->ypos);
 	}
+}
+
+/*
+ * Draw an 8x8 bitmap at location (x,y)
+ */
+void NewGui::drawBitmap(uint32 bitmap[8], int x, int y, byte color)
+{
+	VirtScreen *vs = _s->findVirtScreen(y);
+	byte *ptr = getBasePtr(x, y, vs);
+	if (ptr == NULL)
+		return;
+
+	for (int y2 = 0; y2 < 8; y2++) {
+		uint32 mask = 0xF0000000;
+		for (int x2 = 0; x2 < 8; x2++) {
+			if (bitmap[y2] & mask)
+				ptr[x2] = color;
+			mask >>= 4;
+		}
+		ptr += 320;
+	}
+
+	_s->setVirtscreenDirty(vs, x, y, x + 8, y + 8);
 }

Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- newgui.h	7 Jul 2002 22:44:29 -0000	1.5
+++ newgui.h	7 Jul 2002 23:37:47 -0000	1.6
@@ -23,8 +23,9 @@
 
 #include "scummsys.h"
 
-class Scumm;
 class Dialog;
+class Scumm;
+class VirtScreen;
 
 // Extremly simple stack class, doesn't even do any error checking (for now)
 class DialogStack {
@@ -92,12 +93,13 @@
 
 public:
 	// Drawing
-	byte *getBasePtr(int x, int y);
+	byte *getBasePtr(int x, int y, VirtScreen *vs = 0);
 	void box(int x, int y, int width, int height);
     void line(int x, int y, int x2, int y2, byte color);
     void clearArea(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 drawBitmap(uint32 bitmap[8], int x, int y, byte color);
 
 	// Query a string from the resources
 	const char *queryResString(int stringno);





More information about the Scummvm-git-logs mailing list