diff --git a/data/gui/screens/options_video.stkgui b/data/gui/screens/options_video.stkgui
index a9a60688c..028758ba1 100644
--- a/data/gui/screens/options_video.stkgui
+++ b/data/gui/screens/options_video.stkgui
@@ -75,12 +75,12 @@
-
+
-
+
diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp
index 6b0e5ca2e..a9fab1881 100644
--- a/src/graphics/irr_driver.cpp
+++ b/src/graphics/irr_driver.cpp
@@ -530,6 +530,8 @@ begin:
UserConfigParams::m_vulkan_fullscreen_desktop) ||
UserConfigParams::m_non_ge_fullscreen_desktop;
#endif
+ if (UserConfigParams::m_swap_interval > 1)
+ UserConfigParams::m_swap_interval = 1;
// Try 32 and, upon failure, 24 then 16 bit per pixels
for (int bits=32; bits>15; bits -=8)
diff --git a/src/main_android.cpp b/src/main_android.cpp
index 38fba5b08..517d161d7 100644
--- a/src/main_android.cpp
+++ b/src/main_android.cpp
@@ -311,6 +311,8 @@ void getConfigForDevice(const char* dev)
}
}
}
+ // TODO remove when vulkan is used as it uses less power than gles3
+ UserConfigParams::m_max_fps = 30;
}
#endif
diff --git a/src/states_screens/options/options_screen_video.cpp b/src/states_screens/options/options_screen_video.cpp
index 4bdf2c1cb..d354e6451 100644
--- a/src/states_screens/options/options_screen_video.cpp
+++ b/src/states_screens/options/options_screen_video.cpp
@@ -51,6 +51,7 @@
#include
#include
+#include
#include
using namespace GUIEngine;
@@ -252,31 +253,30 @@ void OptionsScreenVideo::init()
assert( vsync != NULL );
vsync->clearLabels();
-#ifdef IOS_STK
- //I18N: In the video options, maximum frame per second
- getWidget("vsync_label")->setText(_("Maximum FPS"));
- vsync->addLabel("30");
- vsync->addLabel("60");
- vsync->addLabel("120");
- vsync->setValue(UserConfigParams::m_swap_interval);
-#else
- vsync->addLabel(_("Disabled"));
- //I18N: In the video options, full vertical sync (usually 60fps)
- vsync->addLabel(_("Full"));
+ //I18N: In the video options
+ vsync->addLabel(_("Vertical Sync"));
+ std::set fps = { 30, 60, 120, 180, 250, 500, 1000 };
+ fps.insert(UserConfigParams::m_max_fps);
+ for (auto& i : fps)
+ vsync->addLabel(core::stringw(i));
if (UserConfigParams::m_swap_interval > 1)
UserConfigParams::m_swap_interval = 1;
- vsync->setValue(UserConfigParams::m_swap_interval);
+ if (UserConfigParams::m_swap_interval == 1)
+ vsync->setValue(0);
+ else
+ {
+ auto it = fps.find(UserConfigParams::m_max_fps);
+ assert(it != fps.end());
+ vsync->setValue(1 + std::distance(fps.begin(), it));
+ }
//I18N: in graphical options. The \n is a newline character, place it where appropriate, two can be used if required.
core::stringw vsync_tooltip = _("Vsync forces the graphics card to supply a new frame\nonly when the monitor is ready to display it.");
- //I18N: in graphical options.
- vsync_tooltip = vsync_tooltip + L"\n" + _("Full: one frame per monitor refresh");
//I18N: in graphical options.
vsync_tooltip = vsync_tooltip + L"\n" + _("Vsync will not work if your drivers don't support it.");
vsync->setTooltip(vsync_tooltip);
-#endif
// Setup Render Resolution (scale_rtts) spinner
GUIEngine::SpinnerWidget* scale_rtts = getWidget("scale_rtts");
@@ -865,7 +865,21 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
{
GUIEngine::SpinnerWidget* vsync = getWidget("vsync");
assert( vsync != NULL );
- UserConfigParams::m_swap_interval = vsync->getValue();
+ int swap = vsync->getValue();
+ if (swap == 0)
+ {
+ UserConfigParams::m_swap_interval = 1;
+ UserConfigParams::m_max_fps.revertToDefaults();
+ }
+ else
+ {
+ UserConfigParams::m_swap_interval = 0;
+ std::string fps = StringUtils::wideToUtf8(vsync->getStringValue());
+ UserConfigParams::m_max_fps.revertToDefaults();
+ int max_fps = UserConfigParams::m_max_fps;
+ StringUtils::fromString(fps, max_fps);
+ UserConfigParams::m_max_fps = max_fps;
+ }
#if !defined(SERVER_ONLY) && defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
update_swap_interval(UserConfigParams::m_swap_interval);
#endif