[Scummvm-cvs-logs] SF.net SVN: scummvm: [23661] scummvm/trunk/common

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Aug 4 15:10:36 CEST 2006


Revision: 23661
Author:   fingolfin
Date:     2006-08-04 06:10:28 -0700 (Fri, 04 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23661&view=rev

Log Message:
-----------
Added new method OSystem::getScreenChangeID(), which can be used by code to track screen changes even without getting all EVENT_SCREEN_CHANGED events

Modified Paths:
--------------
    scummvm/trunk/backends/platform/sdl/events.cpp
    scummvm/trunk/backends/platform/sdl/sdl-common.h
    scummvm/trunk/backends/platform/sdl/sdl.cpp
    scummvm/trunk/backends/platform/wince/wince-sdl.cpp
    scummvm/trunk/common/system.h
Modified: scummvm/trunk/backends/platform/sdl/events.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/events.cpp	2006-08-04 09:46:40 UTC (rev 23660)
+++ scummvm/trunk/backends/platform/sdl/events.cpp	2006-08-04 13:10:28 UTC (rev 23661)
@@ -180,6 +180,7 @@
 	if (_modeChanged) {
 		_modeChanged = false;
 		event.type = EVENT_SCREEN_CHANGED;
+		_screenChangeCount++;
 		return true;
 	}
 

Modified: scummvm/trunk/backends/platform/sdl/sdl-common.h
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl-common.h	2006-08-04 09:46:40 UTC (rev 23660)
+++ scummvm/trunk/backends/platform/sdl/sdl-common.h	2006-08-04 13:10:28 UTC (rev 23661)
@@ -69,6 +69,8 @@
 	// Typically, 320x200
 	virtual void initSize(uint w, uint h); // overloaded by CE backend
 
+	virtual int getScreenChangeID() const { return _screenChangeCount; }
+
 	// Set colors of the palette
 	void setPalette(const byte *colors, uint start, uint num);
 
@@ -265,6 +267,7 @@
 	/** Current video mode flags (see DF_* constants) */
 	uint32 _modeFlags;
 	bool _modeChanged;
+	int _screenChangeCount;
 
 	/** True if aspect ratio correction is enabled. */
 	bool _adjustAspectRatio;

Modified: scummvm/trunk/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.cpp	2006-08-04 09:46:40 UTC (rev 23660)
+++ scummvm/trunk/backends/platform/sdl/sdl.cpp	2006-08-04 13:10:28 UTC (rev 23661)
@@ -178,7 +178,7 @@
 	_overlayVisible(false),
 	_overlayscreen(0), _tmpscreen2(0),
 	_samplesPerSec(0),
-	_cdrom(0), _scalerProc(0), _modeChanged(false), _dirtyChecksums(0),
+	_cdrom(0), _scalerProc(0), _modeChanged(false), _screenChangeCount(0), _dirtyChecksums(0),
 	_mouseVisible(false), _mouseDrawn(false), _mouseData(0), _mouseSurface(0),
 	_mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true),
 	_joystick(0),

Modified: scummvm/trunk/backends/platform/wince/wince-sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/wince/wince-sdl.cpp	2006-08-04 09:46:40 UTC (rev 23660)
+++ scummvm/trunk/backends/platform/wince/wince-sdl.cpp	2006-08-04 13:10:28 UTC (rev 23661)
@@ -2082,6 +2082,7 @@
 	if (_modeChanged) {
 		_modeChanged = false;
 		event.type = EVENT_SCREEN_CHANGED;
+		screenChangeCount++;
 		return true;
 	}
 

Modified: scummvm/trunk/common/system.h
===================================================================
--- scummvm/trunk/common/system.h	2006-08-04 09:46:40 UTC (rev 23660)
+++ scummvm/trunk/common/system.h	2006-08-04 13:10:28 UTC (rev 23661)
@@ -310,6 +310,21 @@
 	virtual void initSize(uint width, uint height) = 0;
 
 	/**
+	 * Return an int value which is changed whenever any screen
+	 * parameters (like the resolution) change. That is, whenever a
+	 * EVENT_SCREEN_CHANGED would be sent. You can track this value
+	 * in your code to detect screen changes in case you do not have
+	 * full control over the event loop(s) being used (like the GUI
+	 * code).
+	 *
+	 * @return an integer which can be used to track screen changes
+	 *
+	 * @note Backends which generate EVENT_SCREEN_CHANGED events MUST
+	 *       overload this method appropriately.
+	 */
+	virtual int getScreenChangeID() const { return 0; }
+
+	/**
 	 * Begin a new GFX transaction, which is a sequence of GFX mode changes.
 	 * The idea behind GFX transactions is to make it possible to activate
 	 * several different GFX changes at once as a "batch" operation. For


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list