diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-13 15:56:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-13 15:56:56 +0300 |
commit | cd0baf3217701134a8e61932fd14c39cec0cf242 (patch) | |
tree | 7d18a8b58d753865c3de9027fd384035375c7ab9 /src/graphicsmanager.cpp | |
parent | e71aed97c2d885c8113561c1e0cad91454adeb57 (diff) | |
download | plus-cd0baf3217701134a8e61932fd14c39cec0cf242.tar.gz plus-cd0baf3217701134a8e61932fd14c39cec0cf242.tar.bz2 plus-cd0baf3217701134a8e61932fd14c39cec0cf242.tar.xz plus-cd0baf3217701134a8e61932fd14c39cec0cf242.zip |
Fix compilation errors with different flags.
Also fix renderer selection in build without OpenGL.
Diffstat (limited to 'src/graphicsmanager.cpp')
-rw-r--r-- | src/graphicsmanager.cpp | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index ecc05cd4f..73ed3d88a 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -232,7 +232,7 @@ void GraphicsManager::initGraphics(const bool noOpenGL) useOpenGL = intToRenderType(config.getIntValue("opengl")); // Setup image loading for the right image format - OpenGLImageHelper::setLoadAsOpenGL(useOpenGL); + ImageHelper::setOpenGlMode(useOpenGL); // Create the graphics context switch (useOpenGL) @@ -286,18 +286,51 @@ void GraphicsManager::initGraphics(const bool noOpenGL) mUseAtlases = (useOpenGL == RENDER_NORMAL_OPENGL || useOpenGL == RENDER_SAFE_OPENGL || useOpenGL == RENDER_GLES_OPENGL) && config.getBoolValue("useAtlases"); -#else + +#else // USE_OPENGL + void GraphicsManager::initGraphics(const bool noOpenGL A_UNUSED) { + RenderType useOpenGL = RENDER_SOFTWARE; + if (!noOpenGL) + useOpenGL = intToRenderType(config.getIntValue("opengl")); + + // Setup image loading for the right image format + ImageHelper::setOpenGlMode(useOpenGL); + // Create the graphics context - imageHelper = new SDLImageHelper; + switch (useOpenGL) + { + case RENDER_SOFTWARE: + case RENDER_SAFE_OPENGL: + case RENDER_GLES_OPENGL: + case RENDER_NORMAL_OPENGL: + default: +#ifndef USE_SDL2 + case RENDER_SDL2_DEFAULT: +#endif #ifdef USE_SDL2 - surfaceImageHelper = new SurfaceImageHelper; + imageHelper = new SDL2SoftwareImageHelper; + surfaceImageHelper = new SurfaceImageHelper; + mainGraphics = new SDL2SoftwareGraphics; #else - surfaceImageHelper = imageHelper; + imageHelper = new SDLImageHelper; + surfaceImageHelper = imageHelper; + mainGraphics = new SDLGraphics; #endif - mainGraphics = new SDLGraphics; + break; +#ifdef USE_SDL2 + case RENDER_SDL2_DEFAULT: + imageHelper = new SDLImageHelper; + surfaceImageHelper = new SurfaceImageHelper; + mainGraphics = new SDLGraphics; + mainGraphics->setRendererFlags(SDL_RENDERER_ACCELERATED); + break; #endif + }; + +#endif // USE_OPENGL + } void GraphicsManager::setVideoMode() |