diff options
-rw-r--r-- | backends/platform/sdl/events.cpp | 1 | ||||
-rw-r--r-- | backends/platform/sdl/sdl-common.h | 3 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 2 | ||||
-rw-r--r-- | backends/platform/wince/wince-sdl.cpp | 1 | ||||
-rw-r--r-- | common/system.h | 15 |
5 files changed, 21 insertions, 1 deletions
diff --git a/backends/platform/sdl/events.cpp b/backends/platform/sdl/events.cpp index 72afad36df..22bf8f9564 100644 --- a/backends/platform/sdl/events.cpp +++ b/backends/platform/sdl/events.cpp @@ -180,6 +180,7 @@ bool OSystem_SDL::pollEvent(Event &event) { if (_modeChanged) { _modeChanged = false; event.type = EVENT_SCREEN_CHANGED; + _screenChangeCount++; return true; } diff --git a/backends/platform/sdl/sdl-common.h b/backends/platform/sdl/sdl-common.h index f4c9383c63..093e7950f9 100644 --- a/backends/platform/sdl/sdl-common.h +++ b/backends/platform/sdl/sdl-common.h @@ -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; diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index b6d2d675df..ca00349020 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -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), diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 6ba02e3949..f29c3dde96 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -2082,6 +2082,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) { if (_modeChanged) { _modeChanged = false; event.type = EVENT_SCREEN_CHANGED; + screenChangeCount++; return true; } diff --git a/common/system.h b/common/system.h index 776e76798a..91ea05b928 100644 --- a/common/system.h +++ b/common/system.h @@ -310,6 +310,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 * several different GFX changes at once as a "batch" operation. For |