ManaPlus
src
render
renderers.cpp
Go to the documentation of this file.
1
/*
2
* The ManaPlus Client
3
* Copyright (C) 2013-2019 The ManaPlus Developers
4
* Copyright (C) 2019-2021 Andrei Karas
5
*
6
* This file is part of The ManaPlus Client.
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
*/
21
22
#include "
render/renderers.h
"
23
24
#include "
debug.h
"
25
26
static
RenderType
getDefault
()
noexcept2
A_CONST;
27
28
static
RenderType
getDefault
()
noexcept2
29
{
30
#ifdef USE_OPENGL
31
#ifdef ANDROID
32
return
RENDER_GLES_OPENGL
;
33
#else
// ANDROID
34
35
return
RENDER_NORMAL_OPENGL
;
36
#endif
// ANDROID
37
#else
// USE_OPENGL
38
39
return
RENDER_SOFTWARE
;
40
#endif
// USE_OPENGL
41
}
42
43
RenderType
intToRenderType
(
const
int
mode)
noexcept2
44
{
45
#ifdef __SWITCH__
46
return
RENDER_GLES2_OPENGL
;
47
#endif
48
if
(mode < 0 || mode >=
RENDER_LAST
)
49
return
getDefault
();
50
51
if
(mode !=
RENDER_SOFTWARE
52
#
if
defined(USE_OPENGL)
53
54
// with OpenGL start
55
#
if
defined(ANDROID)
56
57
// with OpenGL + with ANDROID start
58
#
if
defined(USE_SDL2)
59
&& mode !=
RENDER_GLES_OPENGL
60
&& mode !=
RENDER_SDL2_DEFAULT
)
61
#else
// defined(USE_SDL2)
62
63
&& mode !=
RENDER_GLES_OPENGL
)
64
#endif
// defined(USE_SDL2)
65
// with OpenGL + with ANDROID end
66
67
#elif defined(__native_client__)
68
69
// with OpenGL + with nacl start
70
#if defined(USE_SDL2)
71
&& mode !=
RENDER_SAFE_OPENGL
72
&& mode !=
RENDER_GLES2_OPENGL
73
&& mode !=
RENDER_SDL2_DEFAULT
)
74
#
else
// defined(USE_SDL2)
75
76
&& mode !=
RENDER_SAFE_OPENGL
77
&& mode !=
RENDER_GLES2_OPENGL
)
78
#endif
// defined(USE_SDL2)
79
// with OpenGL + with nacl end
80
81
#else
// defined(ANDROID)
82
83
// with OpenGL + without ANDROID start
84
#if defined(USE_SDL2)
85
&& mode !=
RENDER_NORMAL_OPENGL
86
&& mode !=
RENDER_MODERN_OPENGL
87
&& mode !=
RENDER_SAFE_OPENGL
88
&& mode !=
RENDER_GLES_OPENGL
89
&& mode !=
RENDER_GLES2_OPENGL
90
&& mode !=
RENDER_SDL2_DEFAULT
)
91
#
else
// defined(USE_SDL2)
92
93
&& mode !=
RENDER_NORMAL_OPENGL
94
&& mode !=
RENDER_MODERN_OPENGL
95
&& mode !=
RENDER_SAFE_OPENGL
96
&& mode !=
RENDER_GLES_OPENGL
97
&& mode !=
RENDER_GLES2_OPENGL
)
98
#endif
// defined(USE_SDL2)
99
// with OpenGL + without ANDROID end
100
101
#endif
// defined(ANDROID)
102
// with OpenGL end
103
104
#else
// defined(USE_OPENGL)
105
106
// without OpenGL start
107
#if defined(USE_SDL2)
108
&& mode !=
RENDER_SDL2_DEFAULT
)
109
#elif !defined(USE_SDL2)
110
)
111
#endif
// defined(USE_SDL2)
112
// without OpenGL end
113
114
#endif
// defined(USE_OPENGL)
115
116
{
117
return
getDefault
();
118
}
119
120
return
static_cast<
RenderType
>
(mode);
121
}
debug.h
noexcept2
#define noexcept2
Definition:
localconsts.h:50
intToRenderType
RenderType intToRenderType(const int mode)
Definition:
renderers.cpp:43
getDefault
static RenderType getDefault() A_CONST
Definition:
renderers.cpp:28
renderers.h
RenderType
RenderType
Definition:
rendertype.h:26
RENDER_SAFE_OPENGL
@ RENDER_SAFE_OPENGL
Definition:
rendertype.h:29
RENDER_GLES2_OPENGL
@ RENDER_GLES2_OPENGL
Definition:
rendertype.h:33
RENDER_GLES_OPENGL
@ RENDER_GLES_OPENGL
Definition:
rendertype.h:30
RENDER_MODERN_OPENGL
@ RENDER_MODERN_OPENGL
Definition:
rendertype.h:32
RENDER_LAST
@ RENDER_LAST
Definition:
rendertype.h:35
RENDER_NORMAL_OPENGL
@ RENDER_NORMAL_OPENGL
Definition:
rendertype.h:28
RENDER_SDL2_DEFAULT
@ RENDER_SDL2_DEFAULT
Definition:
rendertype.h:31
RENDER_SOFTWARE
@ RENDER_SOFTWARE
Definition:
rendertype.h:27
Generated on Wed Mar 17 2021 19:19:09 for ManaPlus by
1.9.1