First pass to update video options menu

This commit is contained in:
Marianne Gagnon 2014-04-14 19:05:33 -04:00
parent 60a3cfb3fd
commit 9993e31601
4 changed files with 125 additions and 69 deletions

View File

@ -9,45 +9,97 @@
<div layout="horizontal-row" width="100%" height="fit"> <div layout="horizontal-row" width="100%" height="fit">
<checkbox id="pixelshaders"/> <checkbox id="pixelshaders"/>
<spacer width="10" height="10"/> <spacer width="10" height="10"/>
<label text="Pixel Shaders (requires restart)" I18N="Video settings"/> <label text="Pixel Shaders" I18N="Video settings"/>
</div> </div>
<spacer height="4" width="10" /> <spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit"> <div layout="horizontal-row" width="100%" height="fit">
<spacer width="50" height="10" /> <spacer width="50" height="10" />
<checkbox id="motionblur"/> <checkbox id="dynamiclight"/>
<spacer width="10" height="10"/> <spacer width="10" height="10"/>
<label text="Motion blur" I18N="Video settings"/> <label text="Dynamic lights" I18N="Video settings"/>
</div> </div>
<spacer height="4" width="10" /> <spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit"> <div layout="horizontal-row" width="100%" height="fit">
<spacer width="50" height="10" /> <spacer width="110" height="10" />
<checkbox id="mlaa"/> <label text="Shadows" I18N="Video settings"/>
<spacer width="10" height="10"/>
<label text="Anti-aliasing" I18N="Video settings"/>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<spacer width="50" height="10" />
<label text="Ambient Occlusion" I18N="Video settings"/>
<spacer width="10" height="10"/>
<gauge id="ssao" min_value="0" max_value="2" width="50%"/>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<spacer width="50" height="10" />
<label text="Shadows (requires restart)" I18N="Video settings"/>
<spacer width="10" height="10"/> <spacer width="10" height="10"/>
<gauge id="shadows" min_value="0" max_value="2" width="50%"/> <gauge id="shadows" min_value="0" max_value="2" width="50%"/>
</div> </div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="50%" height="fit">
<spacer width="50" height="10" />
<checkbox id="bloom"/>
<spacer width="10" height="10"/>
<label text="Bloom" I18N="Video settings"/>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="50%" height="fit">
<spacer width="50" height="10" />
<checkbox id="motionblur"/>
<spacer width="10" height="10"/>
<label text="Motion blur" I18N="Video settings"/>
</div>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="50%" height="fit">
<spacer width="50" height="10" />
<checkbox id="lightshaft"/>
<spacer width="10" height="10"/>
<label text="Light shaft (God rays)" I18N="Video settings"/>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="50%" height="fit">
<spacer width="50" height="10" />
<checkbox id="texture_compression"/>
<spacer width="10" height="10"/>
<label text="Texture compression" I18N="Video settings"/>
</div>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="50%" height="fit">
<spacer width="50" height="10" />
<checkbox id="glow"/>
<spacer width="10" height="10"/>
<label text="Glow (outlines)" I18N="Video settings"/>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="50%" height="fit">
<spacer width="50" height="10" />
<checkbox id="mlaa"/>
<spacer width="10" height="10"/>
<label text="Anti-aliasing" I18N="Video settings"/>
</div>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<spacer width="50" height="10" />
<checkbox id="ssao"/>
<spacer width="10" height="10"/>
<label text="Ambient Occlusion" I18N="Video settings"/>
</div>
<spacer height="4" width="10" /> <spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit"> <div layout="horizontal-row" width="100%" height="fit">
@ -80,20 +132,13 @@
<gauge id="filtering" min_value="0" max_value="5" width="50%" /> <gauge id="filtering" min_value="0" max_value="5" width="50%" />
</div> </div>
<!-- <spacer height="10" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<label text="Anti-aliasing (requires restart)" I18N="Video settings" width="40%" />
<spacer width="10" height="10"/>
<gauge id="antialiasing" min_value="0" max_value="3" width="50%"/>
</div>
<spacer height="4" width="10" />
-->
<label text="* Restart STK to apply new settings" width="100%" text_align="center" I18N="Video settings"/>
<spacer proportion="1"/> <spacer proportion="1"/>
<button id="close" text="Close" align="center"/> <button id="close" text="Apply" align="center"/>
</div> </div>
</stkgui> </stkgui>

View File

@ -33,7 +33,7 @@ using namespace irr::gui;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
CustomVideoSettingsialog::CustomVideoSettingsialog(const float w, const float h) : CustomVideoSettingsDialog::CustomVideoSettingsDialog(const float w, const float h) :
ModalDialog(w, h) ModalDialog(w, h)
{ {
loadFromFile("custom_video_settings.stkgui"); loadFromFile("custom_video_settings.stkgui");
@ -41,13 +41,13 @@ CustomVideoSettingsialog::CustomVideoSettingsialog(const float w, const float h)
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
CustomVideoSettingsialog::~CustomVideoSettingsialog() CustomVideoSettingsDialog::~CustomVideoSettingsDialog()
{ {
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void CustomVideoSettingsialog::beforeAddingWidgets() void CustomVideoSettingsDialog::beforeAddingWidgets()
{ {
getWidget<CheckBoxWidget>("anim_gfx")->setState( UserConfigParams::m_graphical_effects ); getWidget<CheckBoxWidget>("anim_gfx")->setState( UserConfigParams::m_graphical_effects );
getWidget<CheckBoxWidget>("weather_gfx")->setState( UserConfigParams::m_weather_effects ); getWidget<CheckBoxWidget>("weather_gfx")->setState( UserConfigParams::m_weather_effects );
@ -76,56 +76,67 @@ void CustomVideoSettingsialog::beforeAddingWidgets()
filtering->setValue( value ); filtering->setValue( value );
/*
SpinnerWidget* antialias = getWidget<SpinnerWidget>("antialiasing");
antialias->addLabel( _("Disabled") ); // 0
antialias->addLabel( L"x2" ); // 1
antialias->addLabel( L"x4" ); // 2
antialias->addLabel( L"x8" ); // 3
antialias->setValue( UserConfigParams::m_antialiasing );
*/
SpinnerWidget* ssao = getWidget<SpinnerWidget>("ssao");
ssao->addLabel( _("Disabled") ); // 0
ssao->addLabel( _("low") ); // 1
ssao->addLabel( _("high") ); // 2
ssao->setValue( UserConfigParams::m_ssao );
SpinnerWidget* shadows = getWidget<SpinnerWidget>("shadows"); SpinnerWidget* shadows = getWidget<SpinnerWidget>("shadows");
shadows->addLabel( _("Disabled") ); // 0 shadows->addLabel( _("Disabled") ); // 0
shadows->addLabel( _("low") ); // 1 shadows->addLabel( _("low") ); // 1
shadows->addLabel( _("high") ); // 2 shadows->addLabel( _("high") ); // 2
shadows->setValue( UserConfigParams::m_shadows ); shadows->setValue( UserConfigParams::m_shadows );
getWidget<CheckBoxWidget>("motionblur")->setState( UserConfigParams::m_motionblur ); getWidget<CheckBoxWidget>("dynamiclight")->setState(UserConfigParams::m_dynamic_lights);
getWidget<CheckBoxWidget>("mlaa")->setState( UserConfigParams::m_mlaa ); getWidget<CheckBoxWidget>("lightshaft")->setState(UserConfigParams::m_light_shaft);
// getWidget<CheckBoxWidget>("pixelshaders")->setState(UserConfigParams::m_pixel_shaders); getWidget<CheckBoxWidget>("motionblur")->setState(UserConfigParams::m_motionblur);
getWidget<CheckBoxWidget>("mlaa")->setState(UserConfigParams::m_mlaa);
getWidget<CheckBoxWidget>("glow")->setState(UserConfigParams::m_glow);
getWidget<CheckBoxWidget>("ssao")->setState(UserConfigParams::m_ssao);
getWidget<CheckBoxWidget>("bloom")->setState(UserConfigParams::m_bloom);
getWidget<CheckBoxWidget>("texture_compression")->setState(UserConfigParams::m_texture_compression);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
GUIEngine::EventPropagation CustomVideoSettingsialog::processEvent(const std::string& eventSource) GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::string& eventSource)
{ {
if (eventSource == "close") if (eventSource == "close")
{ {
bool dynamic_light = getWidget<CheckBoxWidget>("dynamiclight")->getState();
UserConfigParams::m_dynamic_lights = dynamic_light;
UserConfigParams::m_graphical_effects = UserConfigParams::m_graphical_effects =
getWidget<CheckBoxWidget>("anim_gfx")->getState(); getWidget<CheckBoxWidget>("anim_gfx")->getState();
UserConfigParams::m_weather_effects = UserConfigParams::m_weather_effects =
getWidget<CheckBoxWidget>("weather_gfx")->getState(); getWidget<CheckBoxWidget>("weather_gfx")->getState();
//UserConfigParams::m_antialiasing =
// getWidget<SpinnerWidget>("antialiasing")->getValue();
UserConfigParams::m_motionblur = UserConfigParams::m_motionblur =
getWidget<CheckBoxWidget>("motionblur")->getState(); getWidget<CheckBoxWidget>("motionblur")->getState();
UserConfigParams::m_show_steering_animations = UserConfigParams::m_show_steering_animations =
getWidget<SpinnerWidget>("steering_animations")->getValue(); getWidget<SpinnerWidget>("steering_animations")->getValue();
// UserConfigParams::m_pixel_shaders =
// getWidget<CheckBoxWidget>("pixelshaders")->getState(); if (dynamic_light)
{
UserConfigParams::m_shadows =
getWidget<SpinnerWidget>("shadows")->getValue();
}
else
{
UserConfigParams::m_shadows = 0;
}
UserConfigParams::m_mlaa = UserConfigParams::m_mlaa =
getWidget<CheckBoxWidget>("mlaa")->getState(); getWidget<CheckBoxWidget>("mlaa")->getState();
UserConfigParams::m_ssao =
getWidget<SpinnerWidget>("ssao")->getValue(); UserConfigParams::m_ssao =
UserConfigParams::m_shadows = getWidget<CheckBoxWidget>("ssao")->getState();
getWidget<SpinnerWidget>("shadows")->getValue();
UserConfigParams::m_light_shaft =
getWidget<CheckBoxWidget>("lightshaft")->getState();
UserConfigParams::m_glow =
getWidget<CheckBoxWidget>("glow")->getState();
UserConfigParams::m_bloom =
getWidget<CheckBoxWidget>("bloom")->getState();
UserConfigParams::m_texture_compression =
getWidget<CheckBoxWidget>("texture_compression")->getState();
switch (getWidget<SpinnerWidget>("filtering")->getValue()) switch (getWidget<SpinnerWidget>("filtering")->getValue())
{ {

View File

@ -25,15 +25,15 @@
* \brief Dialog that allows the player to select custom video settings * \brief Dialog that allows the player to select custom video settings
* \ingroup states_screens * \ingroup states_screens
*/ */
class CustomVideoSettingsialog : public GUIEngine::ModalDialog class CustomVideoSettingsDialog : public GUIEngine::ModalDialog
{ {
public: public:
/** /**
* Creates a modal dialog with given percentage of screen width and height * Creates a modal dialog with given percentage of screen width and height
*/ */
CustomVideoSettingsialog(const float percentWidth, const float percentHeight); CustomVideoSettingsDialog(const float percentWidth, const float percentHeight);
~CustomVideoSettingsialog(); ~CustomVideoSettingsDialog();
virtual void beforeAddingWidgets(); virtual void beforeAddingWidgets();

View File

@ -442,7 +442,7 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
} }
else if(name == "custom") else if(name == "custom")
{ {
new CustomVideoSettingsialog(0.8f, 0.8f); new CustomVideoSettingsDialog(0.8f, 0.9f);
} }
else if(name == "apply_resolution") else if(name == "apply_resolution")
{ {