From cd0baf3217701134a8e61932fd14c39cec0cf242 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 13 Sep 2013 15:56:56 +0300 Subject: Fix compilation errors with different flags. Also fix renderer selection in build without OpenGL. --- src/graphicsmanager.cpp | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) (limited to 'src/graphicsmanager.cpp') 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() -- cgit v1.2.3-60-g2f50