mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:23:54 +00:00
Merge branch 'fillbars' into 'master'
[Postprocessing] Fillbar and color coding to HUD See merge request OpenMW/openmw!1959
This commit is contained in:
commit
7021b1607e
3 changed files with 26 additions and 2 deletions
|
@ -32,6 +32,7 @@ namespace fx
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mCheckbutton->setCaptionWithReplacing(value ? "#{sOn}" : "#{sOff}");
|
mCheckbutton->setCaptionWithReplacing(value ? "#{sOn}" : "#{sOff}");
|
||||||
|
mFill->setVisible(value);
|
||||||
|
|
||||||
uniform->setValue<bool>(value);
|
uniform->setValue<bool>(value);
|
||||||
}
|
}
|
||||||
|
@ -61,6 +62,7 @@ namespace fx
|
||||||
Base::initialiseOverride();
|
Base::initialiseOverride();
|
||||||
|
|
||||||
assignWidget(mCheckbutton, "Checkbutton");
|
assignWidget(mCheckbutton, "Checkbutton");
|
||||||
|
assignWidget(mFill, "Fill");
|
||||||
|
|
||||||
mCheckbutton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditBool::notifyMouseButtonClick);
|
mCheckbutton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditBool::notifyMouseButtonClick);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ namespace fx
|
||||||
void notifyMouseButtonClick(MyGUI::Widget* sender);
|
void notifyMouseButtonClick(MyGUI::Widget* sender);
|
||||||
|
|
||||||
MyGUI::Button* mCheckbutton;
|
MyGUI::Button* mCheckbutton;
|
||||||
|
MyGUI::Widget* mFill;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T, class UType>
|
template <class T, class UType>
|
||||||
|
@ -86,17 +87,26 @@ namespace fx
|
||||||
else
|
else
|
||||||
mValueLabel->setCaption(std::to_string(mValue));
|
mValueLabel->setCaption(std::to_string(mValue));
|
||||||
|
|
||||||
|
float range = 0.f;
|
||||||
|
|
||||||
if (auto uniform = mUniform.lock())
|
if (auto uniform = mUniform.lock())
|
||||||
{
|
{
|
||||||
if constexpr (std::is_fundamental_v<UType>)
|
if constexpr (std::is_fundamental_v<UType>)
|
||||||
|
{
|
||||||
uniform->template setValue<UType>(mValue);
|
uniform->template setValue<UType>(mValue);
|
||||||
|
range = uniform->template getMax<UType>() - uniform->template getMin<UType>();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UType uvalue = uniform->template getValue<UType>();
|
UType uvalue = uniform->template getValue<UType>();
|
||||||
uvalue[mIndex] = mValue;
|
uvalue[mIndex] = mValue;
|
||||||
uniform->template setValue<UType>(uvalue);
|
uniform->template setValue<UType>(uvalue);
|
||||||
|
range = uniform->template getMax<UType>()[mIndex] - uniform->template getMin<UType>()[mIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float fill = (range == 0.f) ? 1.f : mValue / range;
|
||||||
|
mFill->setRealSize(fill, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setValueFromUniform() override
|
void setValueFromUniform() override
|
||||||
|
@ -135,6 +145,7 @@ namespace fx
|
||||||
assignWidget(mValueLabel, "Value");
|
assignWidget(mValueLabel, "Value");
|
||||||
assignWidget(mButtonIncrease, "ButtonIncrease");
|
assignWidget(mButtonIncrease, "ButtonIncrease");
|
||||||
assignWidget(mButtonDecrease, "ButtonDecrease");
|
assignWidget(mButtonDecrease, "ButtonDecrease");
|
||||||
|
assignWidget(mFill, "Fill");
|
||||||
|
|
||||||
mButtonIncrease->eventMouseButtonClick += MyGUI::newDelegate(this, &EditNumber::notifyButtonClicked);
|
mButtonIncrease->eventMouseButtonClick += MyGUI::newDelegate(this, &EditNumber::notifyButtonClicked);
|
||||||
mButtonDecrease->eventMouseButtonClick += MyGUI::newDelegate(this, &EditNumber::notifyButtonClicked);
|
mButtonDecrease->eventMouseButtonClick += MyGUI::newDelegate(this, &EditNumber::notifyButtonClicked);
|
||||||
|
@ -226,6 +237,7 @@ namespace fx
|
||||||
MyGUI::Button* mButtonDecrease;
|
MyGUI::Button* mButtonDecrease;
|
||||||
MyGUI::Button* mButtonIncrease;
|
MyGUI::Button* mButtonIncrease;
|
||||||
MyGUI::Widget* mDragger;
|
MyGUI::Widget* mDragger;
|
||||||
|
MyGUI::Widget* mFill;
|
||||||
MyGUI::TextBox* mValueLabel;
|
MyGUI::TextBox* mValueLabel;
|
||||||
T mValue;
|
T mValue;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,11 @@
|
||||||
|
|
||||||
<Resource type="ResourceLayout" name="MW_ValueEditNumber" version="3.2.0">
|
<Resource type="ResourceLayout" name="MW_ValueEditNumber" version="3.2.0">
|
||||||
<Widget type="Widget" skin="" position="0 0 100 50" align="Stretch" name="Root">
|
<Widget type="Widget" skin="" position="0 0 100 50" align="Stretch" name="Root">
|
||||||
|
<Widget type="Widget" skin="BlackBG" position="0 0 100 50" name="Fill" align="Stretch">
|
||||||
|
<Property key="NeedMouse" value="false"/>
|
||||||
|
<Property key="NeedKey" value="false"/>
|
||||||
|
<Property key="Colour" value="#25436b"/>
|
||||||
|
</Widget>
|
||||||
<Widget type="HBox" skin="MW_Box" position_real="0 0 1 1" align="Stretch" name="Layout">
|
<Widget type="HBox" skin="MW_Box" position_real="0 0 1 1" align="Stretch" name="Layout">
|
||||||
<UserString key="HStretch" value="true"/>
|
<UserString key="HStretch" value="true"/>
|
||||||
<UserString key="VStretch" value="true"/>
|
<UserString key="VStretch" value="true"/>
|
||||||
|
@ -26,6 +31,12 @@
|
||||||
|
|
||||||
<Resource type="ResourceLayout" name="MW_ValueEditBool" version="3.2.0">
|
<Resource type="ResourceLayout" name="MW_ValueEditBool" version="3.2.0">
|
||||||
<Widget type="Widget" skin="" position="0 0 100 50" align="Stretch" name="Root">
|
<Widget type="Widget" skin="" position="0 0 100 50" align="Stretch" name="Root">
|
||||||
|
<Widget type="Widget" skin="BlackBG" position_real="0 0 1 1" name="Fill" align="Stretch">
|
||||||
|
<Property key="NeedMouse" value="false"/>
|
||||||
|
<Property key="NeedKey" value="false"/>
|
||||||
|
<Property key="Colour" value="#25436b"/>
|
||||||
|
<Property key="Visible" value="false"/>
|
||||||
|
</Widget>
|
||||||
<Widget type="HBox" skin="MW_Box" position_real="0 0 1 1" align="Stretch" name="Layout">
|
<Widget type="HBox" skin="MW_Box" position_real="0 0 1 1" align="Stretch" name="Layout">
|
||||||
<UserString key="HStretch" value="true"/>
|
<UserString key="HStretch" value="true"/>
|
||||||
<UserString key="VStretch" value="true"/>
|
<UserString key="VStretch" value="true"/>
|
||||||
|
@ -35,7 +46,6 @@
|
||||||
<UserString key="VStretch" value="true"/>
|
<UserString key="VStretch" value="true"/>
|
||||||
<Property key="TextAlign" value="Center"/>
|
<Property key="TextAlign" value="Center"/>
|
||||||
<Property key="Caption" value="On"/>
|
<Property key="Caption" value="On"/>
|
||||||
<Property key="Colour" value="1 0 0 1"/>
|
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
@ -71,7 +81,7 @@
|
||||||
<Property key="FontName" value="Default"/>
|
<Property key="FontName" value="Default"/>
|
||||||
<Property key="TextAlign" value="Left VCenter"/>
|
<Property key="TextAlign" value="Left VCenter"/>
|
||||||
<Property key="TextColour" value="#{fontcolour=header}"/>
|
<Property key="TextColour" value="#{fontcolour=header}"/>
|
||||||
|
|
||||||
<Child type="Widget" skin="IB_B" offset="0 14 16 2" align="Bottom HStretch"/>
|
<Child type="Widget" skin="IB_B" offset="0 14 16 2" align="Bottom HStretch"/>
|
||||||
<BasisSkin type="SimpleText" offset="0 0 16 14" align="Stretch"/>
|
<BasisSkin type="SimpleText" offset="0 0 16 14" align="Stretch"/>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|
Loading…
Reference in a new issue