aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2013-10-21 00:34:06 +0200
committerJohannes Schickel2013-10-23 22:58:53 +0200
commit17cb26b93c5b6a00dcc9dc66d400e640fe16c097 (patch)
treef3fd3013023ebd12a3b520b0398f218341de01a5
parent4080a7a3f642d7f155f3e706f0c084c3280f5d40 (diff)
downloadscummvm-rg350-17cb26b93c5b6a00dcc9dc66d400e640fe16c097.tar.gz
scummvm-rg350-17cb26b93c5b6a00dcc9dc66d400e640fe16c097.tar.bz2
scummvm-rg350-17cb26b93c5b6a00dcc9dc66d400e640fe16c097.zip
SDL: Simplify initial graphics manager selection for OpenGL.
-rw-r--r--backends/platform/sdl/sdl.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 620d3c58ee..113e77937e 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -172,26 +172,18 @@ void OSystem_SDL::initBackend() {
if (_graphicsManager == 0) {
#ifdef USE_OPENGL
if (ConfMan.hasKey("gfx_mode")) {
+ // If the gfx_mode is from OpenGL, create the OpenGL graphics manager
Common::String gfxMode(ConfMan.get("gfx_mode"));
- bool use_opengl = false;
- const OSystem::GraphicsMode *mode = OpenGLSdlGraphicsManager::supportedGraphicsModes();
- int i = 0;
- while (mode->name) {
- if (scumm_stricmp(mode->name, gfxMode.c_str()) == 0) {
- _graphicsMode = i + _firstGLMode;
- use_opengl = true;
+ for (uint i = _firstGLMode; i < _graphicsModeIds.size(); ++i) {
+ if (!scumm_stricmp(_graphicsModes[i].name, gfxMode.c_str())) {
+ _graphicsManager = new OpenGLSdlGraphicsManager(_desktopWidth, _desktopHeight, _eventSource);
+ _graphicsMode = i;
+ break;
}
-
- mode++;
- ++i;
- }
-
- // If the gfx_mode is from OpenGL, create the OpenGL graphics manager
- if (use_opengl) {
- _graphicsManager = new OpenGLSdlGraphicsManager(_desktopWidth, _desktopHeight, _eventSource);
}
}
#endif
+
if (_graphicsManager == 0) {
_graphicsManager = new SurfaceSdlGraphicsManager(_eventSource);
}