diff options
author | Filippos Karapetis | 2019-03-10 18:32:13 +0200 |
---|---|---|
committer | Filippos Karapetis | 2019-03-10 18:32:13 +0200 |
commit | 769cf5492c57b19cd72545ec7b5617bbb7d6a35a (patch) | |
tree | 284a374078b8441e9126c30b3989c3cbb8c49fe2 /backends/graphics | |
parent | f426ba6c36f4d825e427535514eb68855c64c2d1 (diff) | |
download | scummvm-rg350-769cf5492c57b19cd72545ec7b5617bbb7d6a35a.tar.gz scummvm-rg350-769cf5492c57b19cd72545ec7b5617bbb7d6a35a.tar.bz2 scummvm-rg350-769cf5492c57b19cd72545ec7b5617bbb7d6a35a.zip |
SDL: Wrap the full screen toggle code into a separate function
Diffstat (limited to 'backends/graphics')
-rw-r--r-- | backends/graphics/sdl/sdl-graphics.cpp | 22 | ||||
-rw-r--r-- | backends/graphics/sdl/sdl-graphics.h | 3 |
2 files changed, 16 insertions, 9 deletions
diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp index 767ce24949..cf81e04f4d 100644 --- a/backends/graphics/sdl/sdl-graphics.cpp +++ b/backends/graphics/sdl/sdl-graphics.cpp @@ -314,15 +314,7 @@ bool SdlGraphicsManager::notifyEvent(const Common::Event &event) { if (event.kbd.hasFlags(Common::KBD_ALT) && (event.kbd.keycode == Common::KEYCODE_RETURN || event.kbd.keycode == (Common::KeyCode)SDLK_KP_ENTER)) { - beginGFXTransaction(); - setFeatureState(OSystem::kFeatureFullscreenMode, !getFeatureState(OSystem::kFeatureFullscreenMode)); - endGFXTransaction(); -#ifdef USE_OSD - if (getFeatureState(OSystem::kFeatureFullscreenMode)) - displayMessageOnOSD(_("Fullscreen mode")); - else - displayMessageOnOSD(_("Windowed mode")); -#endif + toggleFullScreen(); return true; } @@ -349,3 +341,15 @@ bool SdlGraphicsManager::notifyEvent(const Common::Event &event) { return false; } + +void SdlGraphicsManager::toggleFullScreen() { + beginGFXTransaction(); + setFeatureState(OSystem::kFeatureFullscreenMode, !getFeatureState(OSystem::kFeatureFullscreenMode)); + endGFXTransaction(); +#ifdef USE_OSD + if (getFeatureState(OSystem::kFeatureFullscreenMode)) + displayMessageOnOSD(_("Fullscreen mode")); + else + displayMessageOnOSD(_("Windowed mode")); +#endif +} diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h index d16402f57c..77c8d5d528 100644 --- a/backends/graphics/sdl/sdl-graphics.h +++ b/backends/graphics/sdl/sdl-graphics.h @@ -184,6 +184,9 @@ protected: SDL_Surface *_hwScreen; SdlEventSource *_eventSource; SdlWindow *_window; + +private: + void toggleFullScreen(); }; #endif |