aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/sdl/sdl-common.cpp17
-rw-r--r--backends/sdl/sdl-common.h2
-rw-r--r--backends/sdl/sdl.cpp21
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
+ }
+}