diff engine/core/video/devicecaps.cpp @ 654:5d6b1820b953

* Added the ability to change screen modes on the fly. This works both in OpenGL and SDL modes. * Added IEngineChangeListener so the client can update the cameras viewport if the screen mode has been changed. I chose to do it this way because the engine has no way to know which camera it should update. It will be up to the client to do it. * The cursor surface is now correctly freed when exiting. * Added DeviceCaps::getNearestScreenMode() for the client to request a supported screen mode. closes[t:315]
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 21 Oct 2010 18:50:50 +0000
parents 01acc9fc35ea
children
line wrap: on
line diff
--- a/engine/core/video/devicecaps.cpp	Fri Oct 15 18:54:34 2010 +0000
+++ b/engine/core/video/devicecaps.cpp	Thu Oct 21 18:50:50 2010 +0000
@@ -53,24 +53,37 @@
 	}
 
 	bool ScreenMode::operator <(const ScreenMode& rhs) const {
-		if (m_bpp < rhs.getBPP() ) {
+
+		//sort by fullscreen first
+		if (!isFullScreen() && rhs.isFullScreen()){
+			return true;
+		}
+		else if (isFullScreen() && !rhs.isFullScreen()){
+			return false;
+		}
+
+		//next by bpp
+		if (m_bpp < rhs.getBPP()){
+			return true;
+		}
+		else if (m_bpp > rhs.getBPP()){
+			return false;
+		}
+
+		//then by screen dimentions
+		if (m_width == rhs.getWidth() && m_height == rhs.getHeight()){
+			if (!(m_SDLFlags & SDL_HWSURFACE) && (rhs.getSDLFlags() & SDL_HWSURFACE)) {
+				//I would like return true so that we prefer hardware surfaces but
+				//it really slows the engine down in fullscreen.  See the SDL FAQ for an
+				//explanation.
+				return false;
+			}
+		}
+
+		else if (m_width < rhs.getWidth() || m_height < rhs.getHeight()) {
 			return true;
 		}
 
-		else if (m_bpp == rhs.getBPP()) {
-			if (m_width == rhs.getWidth() && m_height == rhs.getHeight()){
-				if (!(m_SDLFlags & SDL_HWSURFACE) && (rhs.getSDLFlags() & SDL_HWSURFACE)) {
-					//I would like return true so that we prefer hardware surfaces but
-					//it really slows the engine down in fullscreen.  See the SDL FAQ for an
-					//explanation.
-					return false;
-				}
-			}
-
-			else if (m_width < rhs.getWidth() || m_height < rhs.getHeight()) {
-				return true;
-			}
-		}
 		return false;
 	}