mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 01:25:38 +00:00
Added a 'hideIfZero' property to the rating element
This commit is contained in:
parent
00e6908ccd
commit
6dff5ac75c
|
@ -488,6 +488,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
|||
{"rotation", FLOAT},
|
||||
{"rotationOrigin", NORMALIZED_PAIR},
|
||||
{"stationary", STRING},
|
||||
{"hideIfZero", BOOLEAN},
|
||||
{"gameselector", STRING},
|
||||
{"gameselectorEntry", UNSIGNED_INTEGER},
|
||||
{"interpolation", STRING},
|
||||
|
|
|
@ -21,6 +21,7 @@ RatingComponent::RatingComponent(bool colorizeChanges, bool linearInterpolation)
|
|||
, mColorChangedValue {mMenuColorPrimary}
|
||||
, mColorizeChanges {colorizeChanges}
|
||||
, mOverlay {true}
|
||||
, mHideIfZero {false}
|
||||
{
|
||||
mSize = glm::vec2 {std::round(mRenderer->getScreenHeight() * 0.06f) * NUM_RATING_STARS,
|
||||
std::round(mRenderer->getScreenHeight() * 0.06f)};
|
||||
|
@ -127,6 +128,9 @@ void RatingComponent::render(const glm::mat4& parentTrans)
|
|||
if (!isVisible() || mThemeOpacity == 0.0f || mOpacity == 0.0f)
|
||||
return;
|
||||
|
||||
if (mHideIfZero && mValue == 0.0f)
|
||||
return;
|
||||
|
||||
glm::mat4 trans {parentTrans * getTransform()};
|
||||
|
||||
mIconUnfilled.setOpacity(mOpacity * mThemeOpacity);
|
||||
|
@ -227,6 +231,9 @@ void RatingComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
<< element.substr(7) << "\" defined as \"" << stationary << "\"";
|
||||
}
|
||||
|
||||
if (elem->has("hideIfZero"))
|
||||
mHideIfZero = elem->get<bool>("hideIfZero");
|
||||
|
||||
bool linearInterpolation {false};
|
||||
|
||||
// Enable linear interpolation by default if element is arbitrarily rotated.
|
||||
|
|
|
@ -61,6 +61,7 @@ private:
|
|||
|
||||
bool mColorizeChanges;
|
||||
bool mOverlay;
|
||||
bool mHideIfZero;
|
||||
};
|
||||
|
||||
#endif // ES_APP_COMPONENTS_RATING_COMPONENT_H
|
||||
|
|
Loading…
Reference in a new issue