diff options
author | Max Horn | 2004-02-25 09:53:36 +0000 |
---|---|---|
committer | Max Horn | 2004-02-25 09:53:36 +0000 |
commit | 5e163a51a45a49c2db0a934979c192a6adc53225 (patch) | |
tree | 2d24023ed0689e7c8e71105c28d65944f53975b9 | |
parent | a3bdb31870a7810dd10600611aa962837df442ad (diff) | |
download | scummvm-rg350-5e163a51a45a49c2db0a934979c192a6adc53225.tar.gz scummvm-rg350-5e163a51a45a49c2db0a934979c192a6adc53225.tar.bz2 scummvm-rg350-5e163a51a45a49c2db0a934979c192a6adc53225.zip |
fix fullscreen switch code 'properly' (sorry for missing this one, folks). Since we don't have the OpenGL variant anymore, we could now merge back the two parts of the SDL backend - and maybe split them into multiple files in a different way (events, graphics, audio, misc ?)
svn-id: r13045
-rw-r--r-- | backends/sdl/sdl-common.cpp | 17 | ||||
-rw-r--r-- | backends/sdl/sdl-common.h | 2 | ||||
-rw-r--r-- | backends/sdl/sdl.cpp | 21 |
3 files changed, 24 insertions, 16 deletions
diff --git a/backends/sdl/sdl-common.cpp b/backends/sdl/sdl-common.cpp index 9e280ddd3e..dbc31be385 100644 --- a/backends/sdl/sdl-common.cpp +++ b/backends/sdl/sdl-common.cpp @@ -1111,22 +1111,7 @@ void OSystem_SDL_Common::setFeatureState(Feature f, bool enable) { switch (f) { case kFeatureFullscreenMode: - if (_full_screen != enable) { - //assert(_hwscreen != 0); - _full_screen ^= true; -#ifdef MACOSX - // On OS X, SDL_WM_ToggleFullScreen is currently not implemented. Worse, - // it still always returns -1. So we simply don't call it at all and - // use hotswap_gfx_mode() directly to switch to fullscreen mode. - hotswap_gfx_mode(); -#else - // FIXME: _hwscreen is not currently available from SDL_Common's scope - //if (!SDL_WM_ToggleFullScreen(_hwscreen)) { - // if ToggleFullScreen fails, achieve the same effect with hotswap gfx mode - hotswap_gfx_mode(); - //} -#endif - } + setFullscreenMode(enable); break; case kFeatureAspectRatioCorrection: if (_screenHeight == 200 && _adjustAspectRatio != enable) { diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h index cdd5b0c1de..13ea005690 100644 --- a/backends/sdl/sdl-common.h +++ b/backends/sdl/sdl-common.h @@ -236,6 +236,8 @@ protected: virtual void load_gfx_mode() = 0; virtual void unload_gfx_mode() = 0; virtual void hotswap_gfx_mode() = 0; + + virtual void setFullscreenMode(bool enable) = 0; virtual bool save_screenshot(const char *filename) = 0; diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp index 384af1673c..d936e1beac 100644 --- a/backends/sdl/sdl.cpp +++ b/backends/sdl/sdl.cpp @@ -40,6 +40,8 @@ protected: virtual void unload_gfx_mode(); virtual bool save_screenshot(const char *filename); virtual void hotswap_gfx_mode(); + + virtual void setFullscreenMode(bool enable); }; OSystem_SDL_Common *OSystem_SDL_Common::create_intern() { @@ -367,3 +369,22 @@ bool OSystem_SDL::save_screenshot(const char *filename) { SDL_SaveBMP(_hwscreen, filename); return true; } + +void OSystem_SDL::setFullscreenMode(bool enable) { + if (_full_screen != enable) { + assert(_hwscreen != 0); + _full_screen ^= true; +#ifdef MACOSX + // On OS X, SDL_WM_ToggleFullScreen is currently not implemented. Worse, + // it still always returns -1. So we simply don't call it at all and + // use hotswap_gfx_mode() directly to switch to fullscreen mode. + hotswap_gfx_mode(); +#else + // FIXME: _hwscreen is not currently available from SDL_Common's scope + if (!SDL_WM_ToggleFullScreen(_hwscreen)) { + // if ToggleFullScreen fails, achieve the same effect with hotswap gfx mode + hotswap_gfx_mode(); + } +#endif + } +} |