ManaPlus
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 
24 
25 #include "gui/models/namesmodel.h"
26 
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 
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,
81 
82  // TRANSLATORS: settings option
83  new SetupItemCheckBox(_("Auto adjust performance"), "",
84  "adjustPerfomance", this, "adjustPerfomanceEvent",
86 
87  // TRANSLATORS: settings option
88  new SetupItemCheckBox(_("Hw acceleration"), "",
89  "hwaccel", this, "hwaccelEvent",
91 
92  // TRANSLATORS: settings option
93  new SetupItemCheckBox(_("Enable opacity cache (Software, can "
94  "use much memory)"), "", "alphaCache", this, "alphaCacheEvent",
96 
97 #ifndef USE_SDL2
98  // TRANSLATORS: settings option
99  new SetupItemCheckBox(_("Enable map reduce (Software)"), "",
100  "enableMapReduce", this, "enableMapReduceEvent",
102 #endif // USE_SDL2
103 
104  // TRANSLATORS: settings option
105  new SetupItemCheckBox(_("Enable compound sprite delay (Software)"), "",
106  "enableCompoundSpriteDelay", this, "enableCompoundSpriteDelayEvent",
108 
109  // TRANSLATORS: settings option
110  new SetupItemCheckBox(_("Enable delayed images load (OpenGL)"), "",
111  "enableDelayedAnimations", this, "enableDelayedAnimationsEvent",
113 
114  // TRANSLATORS: settings option
115  new SetupItemCheckBox(_("Enable texture sampler (OpenGL)"), "",
116  "useTextureSampler", this, "useTextureSamplerEvent",
118 
119  // TRANSLATORS: settings option
120  new SetupItemCheckBox(_("Enable OpenGL context creation"),
121  "", "openglContext", this, "openglContextEvent",
123 
124  // TRANSLATORS: settings option
125  new SetupItemCheckBox(_("Enable OpenGL direct state access"),
126  "", "enableDSA", this, "enableDSAEvent",
128 
129 
130  // TRANSLATORS: settings option
131  new SetupItemLabel(_("Better quality (disable for better performance)"),
132  "", this,
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",
140 
141  // TRANSLATORS: settings option
142  new SetupItemCheckBox(_("Show beings transparency"), "",
143  "beingopacity", this, "beingopacityEvent",
145 
146  // TRANSLATORS: settings option
147  new SetupItemCheckBox(_("Enable reorder sprites (need for mods support)."),
148  "", "enableReorderSprites", this, "enableReorderSpritesEvent",
150 
151 
152 #ifndef USE_SDL2
153  // TRANSLATORS: settings option
154  new SetupItemLabel(_("Small memory (enable for lower memory usage)"),
155  "", this,
157 
158  // TRANSLATORS: settings option
159  new SetupItemCheckBox(_("Disable advanced beings caching (Software)"), "",
160  "disableAdvBeingCaching", this, "disableAdvBeingCachingEvent",
162 
163  // TRANSLATORS: settings option
164  new SetupItemCheckBox(_("Disable beings caching (Software)"), "",
165  "disableBeingCaching", this, "disableBeingCachingEvent",
167 #endif // USE_SDL2
168 
169 
170  // TRANSLATORS: settings group
171  new SetupItemLabel(_("Different options (enable or disable can "
172  "improve performance)"), "", this,
174 
175 #ifdef USE_SDL2
176  mSdlDriversList->fillFromVector(sdlDriversList);
178  // TRANSLATORS: settings option
179  _("Try first sdl driver (only for SDL2 default mode)"),
180  "", "sdlDriver", this, "sdlDriverEvent", mSdlDriversList, 100,
182 #endif // USE_SDL2
183 
185  // TRANSLATORS: settings option
186  new SetupItemDropDown(_("Enable texture compression (OpenGL)"), "",
187  "compresstextures", this, "compresstexturesEvent", mTexturesList, 100,
189 
190  // TRANSLATORS: settings option
191  new SetupItemCheckBox(_("Enable rectangular texture extension (OpenGL)"),
192  "", "rectangulartextures", this, "rectangulartexturesEvent",
194 
195  // TRANSLATORS: settings option
196  new SetupItemCheckBox(_("Use new texture internal format (OpenGL)"),
197  "", "newtextures", this, "newtexturesEvent",
199 
200  // TRANSLATORS: settings option
201  new SetupItemCheckBox(_("Enable texture atlases (OpenGL)"), "",
202  "useAtlases", this, "useAtlasesEvent",
204 
205  // TRANSLATORS: settings option
206  new SetupItemCheckBox(_("Cache all sprites per map (can use "
207  "additional memory)"), "", "uselonglivesprites", this,
208  "uselonglivespritesEvent",
210 
211  // TRANSLATORS: settings option
212  new SetupItemCheckBox(_("Cache all sounds (can use additional memory)"),
213  "", "uselonglivesounds", this,
214  "uselonglivesoundsEvent",
216 
217  // TRANSLATORS: settings group
218  new SetupItemLabel(_("Critical options (DO NOT change if you don't "
219  "know what you're doing)"), "", this,
221 
222  // TRANSLATORS: settings option
223  new SetupItemCheckBox(_("Disable logging in game (do not enable)"),
224  "", "disableLoggingInGame", this, "disableLoggingInGameEvent",
226 
227  setDimension(Rect(0, 0, 550, 350));
228 }
229 
231 {
233 #ifdef USE_SDL2
234  delete2(mSdlDriversList)
235 #endif // USE_SDL2
236 }
std::string getStringValue(const std::string &key) const
ContainerPlacer getPlacer(const int x, const int y)
void fillFromArray(const char *const *const arr, const std::size_t size)
Definition: namesmodel.cpp:52
Definition: rect.h:74
ScrollArea * mScroll
void setName(const std::string &name)
Definition: setuptab.h:68
Setup_Perfomance(const Widget2 *const widget)
NamesModel * mTexturesList
void setDimension(const Rect &dimension)
Definition: widget.cpp:169
Configuration config
#define new
Definition: debug_new.h:147
#define delete2(var)
Definition: delete2.h:25
#define N_(s)
Definition: gettext.h:36
#define _(s)
Definition: gettext.h:35
const bool MainConfig_true
Definition: mainconfig.h:30
const bool Separator_true
Definition: separator.h:30
static const char *const texturesList[]
static const int texturesListSize
std::vector< std::string > StringVect
Definition: stringvector.h:29