[Scummvm-cvs-logs] CVS: scummvm/gui newgui.cpp,1.58,1.59 newgui.h,1.26,1.27

Max Horn fingolfin at users.sourceforge.net
Sat Sep 6 13:23:04 CEST 2003


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv15889/gui

Modified Files:
	newgui.cpp newgui.h 
Log Message:
added EVENT_SCREEN_CHANGED; small tweak to the way quit is handled in NewGui

Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- newgui.cpp	5 Sep 2003 21:23:28 -0000	1.58
+++ newgui.cpp	6 Sep 2003 20:21:54 -0000	1.59
@@ -91,6 +91,15 @@
 	_currentKeyDown.keycode = 0;
 }
 
+void NewGui::updateColors() {
+	// Setup some default GUI colors.
+	_bgcolor = _system->RGBToColor(0, 0, 0);
+	_color = _system->RGBToColor(96, 96, 96);
+	_shadowcolor = _system->RGBToColor(64, 64, 64);
+	_textcolor = _system->RGBToColor(32, 160, 32);
+	_textcolorhi = _system->RGBToColor(0, 255, 0);
+}
+
 void NewGui::runLoop() {
 	Dialog *activeDialog = _dialogStack.top();
 	bool didSaveState = false;
@@ -98,20 +107,11 @@
 	if (activeDialog == 0)
 		return;
 	
-	// Setup some default GUI colors. This has to be done here to ensure the
-	// overlay has been created already. Even then, one can get wrong colors, namely
-	// if the GUI is up and then the user toggles to full screen mode - on some system
-	// different color modes (555 vs 565) might be used depending on the resolution
-	// (e.g. that's the case on my system), so we still end up with wrong colors in those
-	// sitauations. At least now the user can fix it by closing and reopening the GUI.
-	
-	// TODO: Let's add a new even type which is sent whenever the backend GFX device
-	// changes (e.g. resized, full screen toggle, etc.).
-	_bgcolor = _system->RGBToColor(0, 0, 0);
-	_color = _system->RGBToColor(96, 96, 96);
-	_shadowcolor = _system->RGBToColor(64, 64, 64);
-	_textcolor = _system->RGBToColor(32, 160, 32);
-	_textcolorhi = _system->RGBToColor(0, 255, 0);
+	// Setup some default GUI colors. Normally this will be done whenever an
+	// EVENT_SCREEN_CHANGED is received. However, not all backends support
+	// that even at this time, so we also do it "manually" whenever a run loop
+	// is entered.
+	updateColors();
 
 	if (!_stateIsSaved) {
 		saveState();
@@ -197,6 +197,9 @@
 					break;
 				case OSystem::EVENT_QUIT:
 					_system->quit();
+					return;
+				case OSystem::EVENT_SCREEN_CHANGED:
+					updateColors();
 					break;
 			}
 		}

Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- newgui.h	1 Aug 2003 12:20:17 -0000	1.26
+++ newgui.h	6 Sep 2003 20:21:54 -0000	1.27
@@ -113,6 +113,7 @@
 	void loop();
 
 	void animateCursor();
+	void updateColors();
 
 public:
 	// Theme colors





More information about the Scummvm-git-logs mailing list