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 /backends/sdl/sdl.cpp | |
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
Diffstat (limited to 'backends/sdl/sdl.cpp')
-rw-r--r-- | backends/sdl/sdl.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
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 + } +} |