ManaPlus
src
gui
widgets
tabs
setup_perfomance.cpp
Go to the documentation of this file.
1
/*
2
* The ManaPlus Client
3
* Copyright (C) 2009 The Mana World Development Team
4
* Copyright (C) 2011-2019 The ManaPlus Developers
5
* Copyright (C) 2009-2021 Andrei Karas
6
*
7
* This file is part of The ManaPlus Client.
8
*
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
*/
22
23
#include "
gui/widgets/tabs/setup_perfomance.h
"
24
25
#include "
gui/models/namesmodel.h
"
26
27
#include "
gui/widgets/containerplacer.h
"
28
#include "
gui/widgets/layouthelper.h
"
29
#include "
gui/widgets/scrollarea.h
"
30
#include "
gui/widgets/setupitem.h
"
31
32
#include "
utils/delete2.h
"
33
#include "
utils/gettext.h
"
34
#ifdef USE_SDL2
35
#include "
configuration.h
"
36
#include "
utils/sdlhelper.h
"
37
#endif
// USE_SDL2
38
39
#include "
debug.h
"
40
41
static
const
int
texturesListSize
= 5;
42
43
static
const
char
*
const
texturesList
[] =
44
{
45
// TRANSLATORS: texture compression type
46
N_
(
"No"
),
47
"s3tc"
,
48
"fxt1"
,
49
"ARB"
,
50
"bptc"
51
};
52
53
Setup_Perfomance::Setup_Perfomance
(
const
Widget2
*
const
widget) :
54
SetupTabScroll
(widget),
55
#ifdef USE_SDL2
56
mSdlDriversList(
new
NamesModel
),
57
#endif
// USE_SDL2
58
mTexturesList(
new
NamesModel
)
59
{
60
// TRANSLATORS: settings tab name
61
setName
(
_
(
"Performance"
));
62
63
// Do the layout
64
LayoutHelper
h(
this
);
65
ContainerPlacer
place = h.
getPlacer
(0, 0);
66
place(0, 0,
mScroll
, 10, 10);
67
68
#ifdef USE_SDL2
69
StringVect
sdlDriversList;
70
SDL::getRenderers(sdlDriversList,
71
config
.
getStringValue
(
"sdlDriver"
));
72
sdlDriversList.insert(sdlDriversList.begin(),
73
// TRANSLATORS: sdl driver name
74
N_
(
"default"
));
75
#endif
// USE_SDL2
76
77
// TRANSLATORS: settings option
78
new
SetupItemLabel
(
_
(
"Better performance (enable for better performance)"
),
79
""
,
this
,
80
Separator_true
);
81
82
// TRANSLATORS: settings option
83
new
SetupItemCheckBox
(
_
(
"Auto adjust performance"
),
""
,
84
"adjustPerfomance"
,
this
,
"adjustPerfomanceEvent"
,
85
MainConfig_true
);
86
87
// TRANSLATORS: settings option
88
new
SetupItemCheckBox
(
_
(
"Hw acceleration"
),
""
,
89
"hwaccel"
,
this
,
"hwaccelEvent"
,
90
MainConfig_true
);
91
92
// TRANSLATORS: settings option
93
new
SetupItemCheckBox
(
_
(
"Enable opacity cache (Software, can "
94
"use much memory)"
),
""
,
"alphaCache"
,
this
,
"alphaCacheEvent"
,
95
MainConfig_true
);
96
97
#ifndef USE_SDL2
98
// TRANSLATORS: settings option
99
new
SetupItemCheckBox
(
_
(
"Enable map reduce (Software)"
),
""
,
100
"enableMapReduce"
,
this
,
"enableMapReduceEvent"
,
101
MainConfig_true
);
102
#endif
// USE_SDL2
103
104
// TRANSLATORS: settings option
105
new
SetupItemCheckBox
(
_
(
"Enable compound sprite delay (Software)"
),
""
,
106
"enableCompoundSpriteDelay"
,
this
,
"enableCompoundSpriteDelayEvent"
,
107
MainConfig_true
);
108
109
// TRANSLATORS: settings option
110
new
SetupItemCheckBox
(
_
(
"Enable delayed images load (OpenGL)"
),
""
,
111
"enableDelayedAnimations"
,
this
,
"enableDelayedAnimationsEvent"
,
112
MainConfig_true
);
113
114
// TRANSLATORS: settings option
115
new
SetupItemCheckBox
(
_
(
"Enable texture sampler (OpenGL)"
),
""
,
116
"useTextureSampler"
,
this
,
"useTextureSamplerEvent"
,
117
MainConfig_true
);
118
119
// TRANSLATORS: settings option
120
new
SetupItemCheckBox
(
_
(
"Enable OpenGL context creation"
),
121
""
,
"openglContext"
,
this
,
"openglContextEvent"
,
122
MainConfig_true
);
123
124
// TRANSLATORS: settings option
125
new
SetupItemCheckBox
(
_
(
"Enable OpenGL direct state access"
),
126
""
,
"enableDSA"
,
this
,
"enableDSAEvent"
,
127
MainConfig_true
);
128
129
130
// TRANSLATORS: settings option
131
new
SetupItemLabel
(
_
(
"Better quality (disable for better performance)"
),
132
""
,
this
,
133
Separator_true
);
134
135
// TRANSLATORS: settings option
136
new
SetupItemCheckBox
(
_
(
"Enable alpha channel fix (Software, can "
137
"be very slow)"
),
"Can slow down drawing"
,
"enableAlphaFix"
,
138
this
,
"enableAlphaFixEvent"
,
139
MainConfig_true
);
140
141
// TRANSLATORS: settings option
142
new
SetupItemCheckBox
(
_
(
"Show beings transparency"
),
""
,
143
"beingopacity"
,
this
,
"beingopacityEvent"
,
144
MainConfig_true
);
145
146
// TRANSLATORS: settings option
147
new
SetupItemCheckBox
(
_
(
"Enable reorder sprites (need for mods support)."
),
148
""
,
"enableReorderSprites"
,
this
,
"enableReorderSpritesEvent"
,
149
MainConfig_true
);
150
151
152
#ifndef USE_SDL2
153
// TRANSLATORS: settings option
154
new
SetupItemLabel
(
_
(
"Small memory (enable for lower memory usage)"
),
155
""
,
this
,
156
Separator_true
);
157
158
// TRANSLATORS: settings option
159
new
SetupItemCheckBox
(
_
(
"Disable advanced beings caching (Software)"
),
""
,
160
"disableAdvBeingCaching"
,
this
,
"disableAdvBeingCachingEvent"
,
161
MainConfig_true
);
162
163
// TRANSLATORS: settings option
164
new
SetupItemCheckBox
(
_
(
"Disable beings caching (Software)"
),
""
,
165
"disableBeingCaching"
,
this
,
"disableBeingCachingEvent"
,
166
MainConfig_true
);
167
#endif
// USE_SDL2
168
169
170
// TRANSLATORS: settings group
171
new
SetupItemLabel
(
_
(
"Different options (enable or disable can "
172
"improve performance)"
),
""
,
this
,
173
Separator_true
);
174
175
#ifdef USE_SDL2
176
mSdlDriversList->fillFromVector(sdlDriversList);
177
new
SetupItemDropDownStr
(
178
// TRANSLATORS: settings option
179
_
(
"Try first sdl driver (only for SDL2 default mode)"
),
180
""
,
"sdlDriver"
,
this
,
"sdlDriverEvent"
, mSdlDriversList, 100,
181
MainConfig_true
);
182
#endif
// USE_SDL2
183
184
mTexturesList
->
fillFromArray
(&
texturesList
[0],
texturesListSize
);
185
// TRANSLATORS: settings option
186
new
SetupItemDropDown
(
_
(
"Enable texture compression (OpenGL)"
),
""
,
187
"compresstextures"
,
this
,
"compresstexturesEvent"
,
mTexturesList
, 100,
188
MainConfig_true
);
189
190
// TRANSLATORS: settings option
191
new
SetupItemCheckBox
(
_
(
"Enable rectangular texture extension (OpenGL)"
),
192
""
,
"rectangulartextures"
,
this
,
"rectangulartexturesEvent"
,
193
MainConfig_true
);
194
195
// TRANSLATORS: settings option
196
new
SetupItemCheckBox
(
_
(
"Use new texture internal format (OpenGL)"
),
197
""
,
"newtextures"
,
this
,
"newtexturesEvent"
,
198
MainConfig_true
);
199
200
// TRANSLATORS: settings option
201
new
SetupItemCheckBox
(
_
(
"Enable texture atlases (OpenGL)"
),
""
,
202
"useAtlases"
,
this
,
"useAtlasesEvent"
,
203
MainConfig_true
);
204
205
// TRANSLATORS: settings option
206
new
SetupItemCheckBox
(
_
(
"Cache all sprites per map (can use "
207
"additional memory)"
),
""
,
"uselonglivesprites"
,
this
,
208
"uselonglivespritesEvent"
,
209
MainConfig_true
);
210
211
// TRANSLATORS: settings option
212
new
SetupItemCheckBox
(
_
(
"Cache all sounds (can use additional memory)"
),
213
""
,
"uselonglivesounds"
,
this
,
214
"uselonglivesoundsEvent"
,
215
MainConfig_true
);
216
217
// TRANSLATORS: settings group
218
new
SetupItemLabel
(
_
(
"Critical options (DO NOT change if you don't "
219
"know what you're doing)"
),
""
,
this
,
220
Separator_true
);
221
222
// TRANSLATORS: settings option
223
new
SetupItemCheckBox
(
_
(
"Disable logging in game (do not enable)"
),
224
""
,
"disableLoggingInGame"
,
this
,
"disableLoggingInGameEvent"
,
225
MainConfig_true
);
226
227
setDimension
(
Rect
(0, 0, 550, 350));
228
}
229
230
Setup_Perfomance::~Setup_Perfomance
()
231
{
232
delete2
(
mTexturesList
)
233
#ifdef USE_SDL2
234
delete2
(mSdlDriversList)
235
#endif
// USE_SDL2
236
}
Configuration::getStringValue
std::string getStringValue(const std::string &key) const
Definition:
configuration.cpp:488
ContainerPlacer
Definition:
containerplacer.h:37
LayoutHelper
Definition:
layouthelper.h:40
LayoutHelper::getPlacer
ContainerPlacer getPlacer(const int x, const int y)
Definition:
layouthelper.cpp:60
NamesModel
Definition:
namesmodel.h:32
NamesModel::fillFromArray
void fillFromArray(const char *const *const arr, const std::size_t size)
Definition:
namesmodel.cpp:52
Rect
Definition:
rect.h:74
SetupItemCheckBox
Definition:
setupitem.h:155
SetupItemDropDownStr
Definition:
setupitem.h:355
SetupItemDropDown
Definition:
setupitem.h:313
SetupItemLabel
Definition:
setupitem.h:286
SetupTabScroll
Definition:
setuptabscroll.h:34
SetupTabScroll::mScroll
ScrollArea * mScroll
Definition:
setuptabscroll.h:76
SetupTab::setName
void setName(const std::string &name)
Definition:
setuptab.h:68
Setup_Perfomance::Setup_Perfomance
Setup_Perfomance(const Widget2 *const widget)
Definition:
setup_perfomance.cpp:53
Setup_Perfomance::mTexturesList
NamesModel * mTexturesList
Definition:
setup_perfomance.h:43
Setup_Perfomance::~Setup_Perfomance
~Setup_Perfomance()
Definition:
setup_perfomance.cpp:230
Widget2
Definition:
widget2.h:37
Widget::setDimension
void setDimension(const Rect &dimension)
Definition:
widget.cpp:169
config
Configuration config
Definition:
configuration.cpp:52
configuration.h
containerplacer.h
debug.h
new
#define new
Definition:
debug_new.h:147
delete2.h
delete2
#define delete2(var)
Definition:
delete2.h:25
gettext.h
N_
#define N_(s)
Definition:
gettext.h:36
_
#define _(s)
Definition:
gettext.h:35
layouthelper.h
MainConfig_true
const bool MainConfig_true
Definition:
mainconfig.h:30
namesmodel.h
scrollarea.h
sdlhelper.h
Separator_true
const bool Separator_true
Definition:
separator.h:30
texturesList
static const char *const texturesList[]
Definition:
setup_perfomance.cpp:43
texturesListSize
static const int texturesListSize
Definition:
setup_perfomance.cpp:41
setup_perfomance.h
setupitem.h
StringVect
std::vector< std::string > StringVect
Definition:
stringvector.h:29
Generated on Wed Mar 17 2021 19:19:07 for ManaPlus by
1.9.1