Add half vsync to gui

This commit is contained in:
Deve 2019-09-28 22:19:03 +02:00
parent fc8f6a218e
commit 98d8aca91a
2 changed files with 34 additions and 23 deletions

View File

@ -27,32 +27,38 @@
<spacer width="2%" height="100%"/>
<box width="80%" height="100%" layout="vertical-row">
<spacer width="5" height="1%"/>
<label width="100%" I18N="In the video settings" text="Graphics"/>
<spacer width="5" height="1%"/>
<!-- ************ GRAPHICAL EFFECTS SETTINGS ************ -->
<div width="75%" height="fit" layout="horizontal-row" id="outer_box" >
<label I18N="In the video settings" text="Graphical Effects Level" align="center"/>
<spacer width="20" height="20"/>
<div layout="vertical-row" proportion="1" height="fit" id="inner_box">
<gauge id="gfx_level" min_value="1" max_value="8" width="8f" align="center" />
<spacer height="5" width="10"/>
<button id="custom" text="Custom settings..." I18N="In the video settings" align="center"/>
<!-- ************ VSYNC ************ -->
<div width="100%" height="fit" layout="horizontal-row">
<spacer width="20" height="100%" />
<div layout="vertical-row" width="fit" height="fit">
<spinner id="vsync" width="8f" align="center" />
</div>
<div layout="vertical-row" proportion="1" height="fit">
<label I18N="In the video settings" text="Vertical Sync (requires restart)" align="left"/>
</div>
</div>
<spacer width="5" height="1%"/>
<!-- ************ VSYNC ************ -->
<div width="75%" height="fit" layout="horizontal-row" >
<spacer width="40" height="2" />
<checkbox id="vsync"/>
<spacer width="20" height="2" />
<label height="100%" I18N="In the video settings" text="Vertical Sync (requires restart)"/>
<!-- ************ GRAPHICAL EFFECTS SETTINGS ************ -->
<div width="100%" height="fit" layout="horizontal-row" id="outer_box" >
<spacer width="20" height="100%" />
<div layout="vertical-row" width="fit" height="fit" id="inner_box">
<gauge id="gfx_level" min_value="1" max_value="8" width="8f" align="center" />
<spacer height="5" width="10"/>
<button id="custom" text="Custom settings..." I18N="In the video settings" align="center"/>
</div>
<div layout="vertical-row" proportion="1" height="fit">
<label I18N="In the video settings" text="Graphical Effects Level" align="left"/>
</div>
</div>
<spacer width="5" height="1%"/>
<spacer width="5" height="3%"/>
<!-- ************ RESOLUTION CHOICE ************ -->
<spacer width="5" height="1%"/>

View File

@ -185,11 +185,17 @@ void OptionsScreenVideo::init()
GUIEngine::SpinnerWidget* gfx =
getWidget<GUIEngine::SpinnerWidget>("gfx_level");
assert( gfx != NULL );
GUIEngine::CheckBoxWidget* vsync =
getWidget<GUIEngine::CheckBoxWidget>("vsync");
GUIEngine::SpinnerWidget* vsync = getWidget<GUIEngine::SpinnerWidget>("vsync");
assert( vsync != NULL );
vsync->setState( UserConfigParams::m_swap_interval > 0 );
vsync->clearLabels();
vsync->addLabel(L"Disabled");
//I18N: In the video options
vsync->addLabel(_("Full"));
//I18N: In the video options
vsync->addLabel(_("Half"));
vsync->setValue(UserConfigParams::m_swap_interval);
// ---- video modes
DynamicRibbonWidget* res = getWidget<DynamicRibbonWidget>("resolutions");
@ -619,10 +625,9 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
}
else if (name == "vsync")
{
GUIEngine::CheckBoxWidget* vsync =
getWidget<GUIEngine::CheckBoxWidget>("vsync");
GUIEngine::SpinnerWidget* vsync = getWidget<GUIEngine::SpinnerWidget>("vsync");
assert( vsync != NULL );
UserConfigParams::m_swap_interval = (int)vsync->getState();
UserConfigParams::m_swap_interval = vsync->getValue();
}
else if (name == "rememberWinpos")
{