aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMax Horn2004-07-16 09:29:09 +0000
committerMax Horn2004-07-16 09:29:09 +0000
commitf2f1687988d9d83cbaa5f0911921fb73aba7d127 (patch)
tree5c9df1a54f7d8c3bd63d08a5c907a243208f57f7 /backends
parent613642efd01b0c4bbbdc167cc85abdc5e4fde549 (diff)
downloadscummvm-rg350-f2f1687988d9d83cbaa5f0911921fb73aba7d127.tar.gz
scummvm-rg350-f2f1687988d9d83cbaa5f0911921fb73aba7d127.tar.bz2
scummvm-rg350-f2f1687988d9d83cbaa5f0911921fb73aba7d127.zip
Only show gfx mode change messages in the OSD if the change was initiated by the user; not if it was done automatically (e.g. because a 640x480 game was started and we auto-switch to 1x scaling)
svn-id: r14223
Diffstat (limited to 'backends')
-rw-r--r--backends/sdl/events.cpp59
-rw-r--r--backends/sdl/graphics.cpp31
-rw-r--r--backends/sdl/sdl.cpp15
3 files changed, 55 insertions, 50 deletions
diff --git a/backends/sdl/events.cpp b/backends/sdl/events.cpp
index 3a25f971db..d1ed7503fd 100644
--- a/backends/sdl/events.cpp
+++ b/backends/sdl/events.cpp
@@ -193,6 +193,13 @@ bool OSystem_SDL::poll_event(Event *event) {
// Alt-Return toggles full screen mode
if (b == KBD_ALT && ev.key.keysym.sym == SDLK_RETURN) {
setFullscreenMode(!_full_screen);
+#ifdef USE_OSD
+ if (_full_screen)
+ displayMessageOnOSD("Fullscreen mode");
+ else
+ displayMessageOnOSD("Windowed mode");
+#endif
+
break;
}
@@ -266,18 +273,35 @@ bool OSystem_SDL::poll_event(Event *event) {
// Ctrl-Alt-a toggles aspect ratio correction
if (ev.key.keysym.sym == 'a') {
setFeatureState(kFeatureAspectRatioCorrection, !_adjustAspectRatio);
+#ifdef USE_OSD
+ char buffer[128];
+ if (_adjustAspectRatio)
+ sprintf(buffer, "Enabled aspect ratio correction\n%d x %d -> %d x %d",
+ _screenWidth, _screenHeight,
+ _hwscreen->w, _hwscreen->h
+ );
+ else
+ sprintf(buffer, "Disabled aspect ratio correction\n%d x %d -> %d x %d",
+ _screenWidth, _screenHeight,
+ _hwscreen->w, _hwscreen->h
+ );
+ displayMessageOnOSD(buffer);
+#endif
+
break;
}
+
+ int newMode = -1;
+
// Increase/decrease the scale factor
// TODO: Shall we 'wrap around' here?
if (ev.key.keysym.sym == SDLK_EQUALS || ev.key.keysym.sym == SDLK_PLUS || ev.key.keysym.sym == SDLK_MINUS ||
ev.key.keysym.sym == SDLK_KP_PLUS || ev.key.keysym.sym == SDLK_KP_MINUS) {
factor += (ev.key.keysym.sym == SDLK_MINUS || ev.key.keysym.sym == SDLK_KP_MINUS) ? -1 : +1;
if (0 <= factor && factor < 4 && s_gfxModeSwitchTable[_scalerType][factor] >= 0) {
- setGraphicsMode(s_gfxModeSwitchTable[_scalerType][factor]);
+ newMode = s_gfxModeSwitchTable[_scalerType][factor];
}
- break;
}
const bool isNormalNumber = (SDLK_1 <= ev.key.keysym.sym && ev.key.keysym.sym <= SDLK_9);
@@ -291,9 +315,36 @@ bool OSystem_SDL::poll_event(Event *event) {
assert(factor > 0);
factor--;
}
- setGraphicsMode(s_gfxModeSwitchTable[_scalerType][factor]);
- break;
+ newMode = s_gfxModeSwitchTable[_scalerType][factor];
}
+
+ if (newMode >= 0) {
+ setGraphicsMode(newMode);
+#ifdef USE_OSD
+ if (_osdSurface) {
+ const char *newScalerName = 0;
+ const GraphicsMode *g = getSupportedGraphicsModes();
+ while (g->name) {
+ if (g->id == _mode) {
+ newScalerName = g->description;
+ break;
+ }
+ g++;
+ }
+ if (newScalerName) {
+ char buffer[128];
+ sprintf(buffer, "Active graphics filter: %s\n%d x %d -> %d x %d",
+ newScalerName,
+ _screenWidth, _screenHeight,
+ _hwscreen->w, _hwscreen->h
+ );
+ displayMessageOnOSD(buffer);
+ }
+ }
+#endif
+
+ }
+ break;
}
#ifdef LINUPY
diff --git a/backends/sdl/graphics.cpp b/backends/sdl/graphics.cpp
index b28eb97ed5..692f200e7f 100644
--- a/backends/sdl/graphics.cpp
+++ b/backends/sdl/graphics.cpp
@@ -121,30 +121,6 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
if (!_screen)
return true;
-#ifdef USE_OSD
- if (_osdSurface) {
- const char *newScalerName = 0;
- const GraphicsMode *g = s_supportedGraphicsModes;
- while (g->name) {
- if (g->id == mode) {
- newScalerName = g->description;
- break;
- }
- g++;
- }
- if (newScalerName) {
- char buffer[128];
- sprintf(buffer, "Active graphics filter: %s\n%d x %d -> %d x %d",
- newScalerName,
- _screenWidth, _screenHeight,
- _hwscreen->w, _hwscreen->h
- );
- displayMessageOnOSD(buffer);
- }
- }
-#endif
-
-
// Blit everything to the screen
_forceFull = true;
internUpdateScreen();
@@ -519,13 +495,6 @@ void OSystem_SDL::setFullscreenMode(bool enable) {
}
#endif
-#ifdef USE_OSD
- if (_full_screen)
- displayMessageOnOSD("Fullscreen mode");
- else
- displayMessageOnOSD("Windowed mode");
-#endif
-
// Blit everything to the screen
internUpdateScreen();
diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp
index 2acfa27526..a15978f791 100644
--- a/backends/sdl/sdl.cpp
+++ b/backends/sdl/sdl.cpp
@@ -163,21 +163,6 @@ void OSystem_SDL::setFeatureState(Feature f, bool enable) {
_adjustAspectRatio ^= true;
hotswap_gfx_mode();
-#ifdef USE_OSD
- char buffer[128];
- if (_adjustAspectRatio)
- sprintf(buffer, "Enabled aspect ratio correction\n%d x %d -> %d x %d",
- _screenWidth, _screenHeight,
- _hwscreen->w, _hwscreen->h
- );
- else
- sprintf(buffer, "Disabled aspect ratio correction\n%d x %d -> %d x %d",
- _screenWidth, _screenHeight,
- _hwscreen->w, _hwscreen->h
- );
- displayMessageOnOSD(buffer);
-#endif
-
// Blit everything to the screen
internUpdateScreen();