ManaPlus
Functions
renderers.cpp File Reference

(aa4ebcf)

#include "render/renderers.h"
#include "debug.h"

Go to the source code of this file.

Functions

static RenderType getDefault () A_CONST
 
RenderType intToRenderType (const int mode)
 

Function Documentation

◆ getDefault()

static RenderType getDefault ( )
static

Definition at line 27 of file renderers.cpp.

References RENDER_GLES_OPENGL, RENDER_NORMAL_OPENGL, and RENDER_SOFTWARE.

Referenced by intToRenderType().

28 {
29 #ifdef USE_OPENGL
30 #ifdef ANDROID
31  return RENDER_GLES_OPENGL;
32 #else // ANDROID
33 
34  return RENDER_NORMAL_OPENGL;
35 #endif // ANDROID
36 #else // USE_OPENGL
37 
38  return RENDER_SOFTWARE;
39 #endif // USE_OPENGL
40 }

◆ intToRenderType()

RenderType intToRenderType ( const int  mode)

Definition at line 42 of file renderers.cpp.

References getDefault(), RENDER_GLES2_OPENGL, RENDER_GLES_OPENGL, RENDER_LAST, RENDER_MODERN_OPENGL, RENDER_NORMAL_OPENGL, RENDER_SAFE_OPENGL, RENDER_SDL2_DEFAULT, and RENDER_SOFTWARE.

Referenced by Setup_Video::action(), Setup_Video::apply(), ConfigManager::backupConfig(), GraphicsManager::createRenderers(), GraphicsManager::initGraphics(), and ConfigManager::storeSafeParameters().

43 {
44  if (mode < 0 || mode >= RENDER_LAST)
45  return getDefault();
46 
47  if (mode != RENDER_SOFTWARE
48 #if defined(USE_OPENGL)
49 
50 // with OpenGL start
51 #if defined(ANDROID)
52 
53 // with OpenGL + with ANDROID start
54 #if defined(USE_SDL2)
55  && mode != RENDER_GLES_OPENGL
56  && mode != RENDER_SDL2_DEFAULT)
57 #else // defined(USE_SDL2)
58 
59  && mode != RENDER_GLES_OPENGL)
60 #endif // defined(USE_SDL2)
61 // with OpenGL + with ANDROID end
62 
63 #elif defined(__native_client__)
64 
65 // with OpenGL + with nacl start
66 #if defined(USE_SDL2)
67  && mode != RENDER_SAFE_OPENGL
68  && mode != RENDER_GLES2_OPENGL
69  && mode != RENDER_SDL2_DEFAULT)
70 #else // defined(USE_SDL2)
71 
72  && mode != RENDER_SAFE_OPENGL
73  && mode != RENDER_GLES2_OPENGL)
74 #endif // defined(USE_SDL2)
75 // with OpenGL + with nacl end
76 
77 #else // defined(ANDROID)
78 
79 // with OpenGL + without ANDROID start
80 #if defined(USE_SDL2)
81  && mode != RENDER_NORMAL_OPENGL
82  && mode != RENDER_MODERN_OPENGL
83  && mode != RENDER_SAFE_OPENGL
84  && mode != RENDER_GLES_OPENGL
85  && mode != RENDER_GLES2_OPENGL
86  && mode != RENDER_SDL2_DEFAULT)
87 #else // defined(USE_SDL2)
88 
89  && mode != RENDER_NORMAL_OPENGL
90  && mode != RENDER_MODERN_OPENGL
91  && mode != RENDER_SAFE_OPENGL
92  && mode != RENDER_GLES_OPENGL
93  && mode != RENDER_GLES2_OPENGL)
94 #endif // defined(USE_SDL2)
95 // with OpenGL + without ANDROID end
96 
97 #endif // defined(ANDROID)
98 // with OpenGL end
99 
100 #else // defined(USE_OPENGL)
101 
102 // without OpenGL start
103 #if defined(USE_SDL2)
104  && mode != RENDER_SDL2_DEFAULT)
105 #elif !defined(USE_SDL2)
106  )
107 #endif // defined(USE_SDL2)
108 // without OpenGL end
109 
110 #endif // defined(USE_OPENGL)
111 
112  {
113  return getDefault();
114  }
115 
116  return static_cast<RenderType>(mode);
117 }
static RenderType getDefault() A_CONST
Definition: renderers.cpp:27
RenderType
Definition: rendertype.h:24