From 50a86463c1caf689922a72cfa6cece06c2ed3455 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 19 Aug 2013 00:54:41 +0200 Subject: [PATCH] SDL: Use OSD in OpenGL SDL backend. --- .../graphics/openglsdl/openglsdl-graphics.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index ce6d7ec7f08d..a1a3e8590afc 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -24,6 +24,9 @@ #include "common/textconsole.h" #include "common/config-manager.h" +#ifdef USE_OSD +#include "common/translation.h" +#endif OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint desktopHeight, SdlEventSource *eventSource) : SdlGraphicsManager(eventSource), _lastVideoModeLoad(0), _hwScreen(nullptr), _lastRequestedWidth(0), _lastRequestedHeight(0), @@ -342,6 +345,14 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { beginGFXTransaction(); setFeatureState(OSystem::kFeatureFullscreenMode, !getFeatureState(OSystem::kFeatureFullscreenMode)); endGFXTransaction(); + +#ifdef USE_OSD + if (getFeatureState(OSystem::kFeatureFullscreenMode)) { + displayMessageOnOSD("Fullscreen mode"); + } else { + displayMessageOnOSD("Windowed mode"); + } +#endif return true; } } else if (event.kbd.hasFlags(Common::KBD_CTRL | Common::KBD_ALT)) { @@ -407,6 +418,11 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { } } +#ifdef USE_OSD + const Common::String osdMsg = Common::String::format("Resolution: %dx%d", _hwScreen->w, _hwScreen->h); + displayMessageOnOSD(osdMsg.c_str()); +#endif + return true; } else if (event.kbd.keycode == Common::KEYCODE_a) { // In case the user changed the window size manually we will @@ -422,6 +438,12 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { // effectively checks whether loadVideoMode has been called. assert(!_ignoreLoadVideoMode); +#ifdef USE_OSD + Common::String osdMsg = "Aspect ratio correction: "; + osdMsg += getFeatureState(OSystem::kFeatureAspectRatioCorrection) ? "enabled" : "disabled"; + displayMessageOnOSD(osdMsg.c_str()); +#endif + return true; } else if (event.kbd.keycode == Common::KEYCODE_f) { // Ctrl+Alt+f toggles the graphics modes. @@ -462,6 +484,11 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { // effectively checks whether loadVideoMode has been called. assert(!_ignoreLoadVideoMode); +#ifdef USE_OSD + const Common::String osdMsg = Common::String::format("Graphics mode: %s", _(modeDesc->description)); + displayMessageOnOSD(osdMsg.c_str()); +#endif + return true; } }