44 #if defined(USE_OPENGL) && !defined(ANDROID) && !defined(__APPLE__)
50 #if defined(ANDROID) || defined(__APPLE__) || !defined(USE_OPENGL)
54 #if defined(ANDROID) || defined(__APPLE__)
68 mFullScreenEnabled(
config.getBoolValue(
"screen")),
70 mFps(
config.getIntValue(
"fpslimit")),
71 mAltFps(
config.getIntValue(
"altfpslimit")),
76 mFsCheckBox(
new CheckBox(this,
_(
"Full screen"), mFullScreenEnabled,
78 mOpenGLDropDown(
new DropDown(widget, mOpenGLListModel,
83 mFpsSlider(
new Slider(this, 2.0, 160.0, 1.0)),
85 mAltFpsSlider(
new Slider(this, 2.0, 160.0, 1.0)),
87 mAltFpsLabel(
new Label(this,
_(
"Alt FPS limit: "))),
88 #
if !defined(ANDROID) && !defined(__APPLE__)
89 #
if !defined(__native_client__) && !defined(__SWITCH__)
91 mDetectButton(
new Button(this,
_(
"Detect best mode"),
"detect",
96 mCustomCursorEnabled(
config.getBoolValue(
"customcursor")),
97 mEnableResize(
config.getBoolValue(
"enableresize")),
98 mNoFrame(
config.getBoolValue(
"noframe")),
100 mAllowHighDPI(
config.getBoolValue(
"allowHighDPI")),
102 mAllowHighDPICheckBox(
new CheckBox(this,
_(
"High DPI"), mAllowHighDPI,
113 mCustomCursorEnabled,
116 mEnableResizeCheckBox(
new CheckBox(this,
_(
"Enable resize"),
119 mNoFrameCheckBox(
new CheckBox(this,
_(
"No frame"), mNoFrame,
149 const std::string videoMode =
toString(
163 mAllowHighDPICheckBox->setActionEventId(
"allowHighDPI");
164 mAllowHighDPICheckBox->addActionListener(
this);
180 place(0, 0, scrollArea, 1, 5).setPadding(2);
190 place(1, 4, mAllowHighDPICheckBox, 2, 1);
195 place(2, 6,
mFpsLabel, 1, 1).setPadding(1);
200 #if !defined(ANDROID) && !defined(__APPLE__) && \
201 !defined(__native_client__) && !defined(__SWITCH__)
207 #ifndef __native_client__
242 #if defined(WIN32) || defined(__APPLE__) || defined(ANDROID)
249 fullscreen = !fullscreen;
252 std::stringstream errorMsg;
256 errorMsg <<
_(
"Failed to switch to windowed mode "
257 "and restoration of old mode also "
258 "failed!") << std::endl;
263 errorMsg <<
_(
"Failed to switch to fullscreen mode"
264 " and restoration of old mode also "
265 "failed!") << std::endl;
270 #if defined(WIN32) || defined(__APPLE__) || defined(ANDROID)
276 _(
"Switching to Full Screen"),
278 _(
"Restart needed for changes to take effect."),
305 _(
"Changing to OpenGL"),
307 _(
"Applying change to OpenGL requires restart."),
360 mAllowHighDPICheckBox->setSelected(mAllowHighDPI);
382 const std::string &
id =
event.getId();
384 if (
id ==
"videomode")
389 if (mode ==
"custom")
400 _(
"Custom resolution (example: 1024x768)"),
402 _(
"Enter new resolution: "),
410 const int width = atoi(mode.substr(0, mode.find(
'x')).c_str());
411 const int height = atoi(mode.substr(mode.find(
'x') + 1).c_str());
412 if ((width == 0) || (height == 0))
418 #if defined(WIN32) || defined(__APPLE__) || defined(ANDROID)
426 if (width < mainGraphics->mActualWidth
427 || height < mainGraphics->mActualHeight)
431 _(
"Screen Resolution Changed"),
433 _(
"Restart your client for the change to take effect.")
435 + std::string(
"\n") +
_(
"Some windows may be moved to "
436 "fit the lowered resolution."),
449 _(
"Screen Resolution Changed"),
451 _(
"Restart your client for the change"
475 if (
id ==
"~videomode")
479 else if (
id ==
"customcursor")
483 else if (
id ==
"fpslimitcheckbox" ||
id ==
"fpslimitslider")
489 tempFps = tempFps > 0 ? tempFps : 60;
498 else if (
id ==
"altfpslimitslider")
501 tempFps = tempFps > 0 ? tempFps :
CAST_S32(
512 else if (
id ==
"enableresize")
516 else if (
id ==
"noframe")
521 else if (
id ==
"allowHighDPI")
523 config.
setValue(
"allowHighDPI", mAllowHighDPICheckBox->isSelected());
526 #if defined(USE_OPENGL) && !defined(ANDROID) && !defined(__APPLE__)
527 else if (
id ==
"detect")
540 conf.
getValue(
"textureSize",
"1024,1024,1024,1024,1024,1024"));
void setSelected(const bool selected)
int getValueInt(const std::string &key, const int deflt) const
std::string getValue(const std::string &key, const std::string &deflt) const
bool getBoolValue(const std::string &key) const
void setValue(const std::string &key, const std::string &value)
int getIntValue(const std::string &key) const
void setSelected(int selected)
TestMain * startDetection()
void setWindowSize(const int width, const int height)
void setCaption(const std::string &caption)
ContainerPlacer getPlacer(const int x, const int y)
void setSelected(const int selected)
void safeError(const std::string &error_text) __attribute__((noreturn))
int getIndexOf(const std::string &widthXHeightMode)
std::string getElementAt(int i)
void setName(const std::string &name)
void action(const ActionEvent &event)
RenderType mOpenGLEnabled
Setup_Video(const Widget2 *const widget)
ModeListModel * mModeListModel
CheckBox * mCustomCursorCheckBox
CheckBox * mEnableResizeCheckBox
CheckBox * mNoFrameCheckBox
OpenGLListModel * mOpenGLListModel
DropDown * mOpenGLDropDown
bool mCustomCursorEnabled
void setValue(const double value)
double getScaleStart() const
Configuration & getConfig()
const std::string & getText() const
GraphicsManager graphicsManager
std::string toString(T const &value)
converts any type to a string
bool setFullScreen(const bool fs)
void doResizeVideo(const int actualWidth, const int actualHeight, const bool always)
RenderType intToRenderType(const int mode)
const int renderToIndex[]
const RenderType indexToRender[]
const bool ShowCenter_true