ManaPlus
renderers.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2013-2018 The ManaPlus Developers
4  *
5  * This file is part of The ManaPlus Client.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include "render/renderers.h"
22 
23 #include "debug.h"
24 
25 static RenderType getDefault() noexcept2 A_CONST;
26 
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 }
41 
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 intToRenderType(const int mode)
Definition: renderers.cpp:42
#define noexcept2
Definition: localconsts.h:49
RenderType
Definition: rendertype.h:24