Skip to content

Commit

Permalink
SDL: Use OSD in OpenGL SDL backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schickel committed Oct 19, 2013
1 parent cc9c991 commit 50a8646
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions backends/graphics/openglsdl/openglsdl-graphics.cpp
Expand Up @@ -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),
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 50a8646

Please sign in to comment.