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

svn-id: r23661
This commit is contained in:
Max Horn 2006-08-04 13:10:28 +00:00
parent af3241f700
commit ca7880df6c
5 changed files with 21 additions and 1 deletions

View File

@ -180,6 +180,7 @@ bool OSystem_SDL::pollEvent(Event &event) {
if (_modeChanged) {
_modeChanged = false;
event.type = EVENT_SCREEN_CHANGED;
_screenChangeCount++;
return true;
}

View File

@ -69,6 +69,8 @@ public:
// 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 @@ protected:
/** Current video mode flags (see DF_* constants) */
uint32 _modeFlags;
bool _modeChanged;
int _screenChangeCount;
/** True if aspect ratio correction is enabled. */
bool _adjustAspectRatio;

View File

@ -178,7 +178,7 @@ OSystem_SDL::OSystem_SDL()
_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),

View File

@ -2082,6 +2082,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
if (_modeChanged) {
_modeChanged = false;
event.type = EVENT_SCREEN_CHANGED;
screenChangeCount++;
return true;
}

View File

@ -309,6 +309,21 @@ public:
*/
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