diff options
-rw-r--r-- | src/render/renderers.cpp | 36 | ||||
-rw-r--r-- | src/render/renderers.h | 2 |
2 files changed, 31 insertions, 7 deletions
diff --git a/src/render/renderers.cpp b/src/render/renderers.cpp index 97364f54a..dcabd0fbf 100644 --- a/src/render/renderers.cpp +++ b/src/render/renderers.cpp @@ -20,19 +20,43 @@ #include "render/renderers.h" -RenderType intToRenderType(const int mode) +static RenderType getDefault() { - if (mode < 0 || mode > RENDER_LAST) - { #ifdef USE_OPENGL #ifdef ANDROID - return RENDER_GLES_OPENGL; + return RENDER_GLES_OPENGL; #else - return RENDER_NORMAL_OPENGL; + return RENDER_NORMAL_OPENGL; #endif #else - return RENDER_SOFTWARE; + return RENDER_SOFTWARE; +#endif +} + +RenderType intToRenderType(const int mode) +{ + if (mode < 0 || mode >= RENDER_LAST) + return getDefault(); + + if (mode != RENDER_SOFTWARE +#if defined(USE_OPENGL) && defined(ANDROID) && defined(USE_SDL2) + && mode != RENDER_GLES_OPENGL && mode != RENDER_SDL2_DEFAULT) +#elif defined(USE_OPENGL) && defined(ANDROID) && !defined(USE_SDL2) + && mode != RENDER_GLES_OPENGL) +#elif defined(USE_OPENGL) && !defined(ANDROID) && defined(USE_SDL2) + && mode != RENDER_NORMAL_OPENGL && mode != RENDER_SAFE_OPENGL + && mode != RENDER_GLES_OPENGL && mode != RENDER_SDL2_DEFAULT) +#elif !defined(USE_OPENGL) && defined(USE_SDL2) + && mode != RENDER_SDL2_DEFAULT) +#elif !defined(USE_OPENGL) && !defined(USE_SDL2) + ) +#elif defined(USE_OPENGL) && !defined(ANDROID) && !defined(USE_SDL2) + && mode != RENDER_NORMAL_OPENGL && mode != RENDER_SAFE_OPENGL + && mode != RENDER_GLES_OPENGL) #endif + { + return getDefault(); } + return static_cast<RenderType>(mode); } diff --git a/src/render/renderers.h b/src/render/renderers.h index 2a6af27d2..c49ca81c4 100644 --- a/src/render/renderers.h +++ b/src/render/renderers.h @@ -31,7 +31,7 @@ enum RenderType RENDER_GLES_OPENGL = 3, RENDER_SDL2_DEFAULT = 4, RENDER_NULL = 5, - RENDER_LAST + RENDER_LAST, }; RenderType intToRenderType(const int mode); |