diff --git a/es-core/src/ThemeData.cpp b/es-core/src/ThemeData.cpp index 8c119484f..46ad6c436 100644 --- a/es-core/src/ThemeData.cpp +++ b/es-core/src/ThemeData.cpp @@ -488,6 +488,7 @@ std::map> {"rotation", FLOAT}, {"rotationOrigin", NORMALIZED_PAIR}, {"stationary", STRING}, + {"hideIfZero", BOOLEAN}, {"gameselector", STRING}, {"gameselectorEntry", UNSIGNED_INTEGER}, {"interpolation", STRING}, diff --git a/es-core/src/components/RatingComponent.cpp b/es-core/src/components/RatingComponent.cpp index 6e1b39b21..7785963c7 100644 --- a/es-core/src/components/RatingComponent.cpp +++ b/es-core/src/components/RatingComponent.cpp @@ -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& theme, << element.substr(7) << "\" defined as \"" << stationary << "\""; } + if (elem->has("hideIfZero")) + mHideIfZero = elem->get("hideIfZero"); + bool linearInterpolation {false}; // Enable linear interpolation by default if element is arbitrarily rotated. diff --git a/es-core/src/components/RatingComponent.h b/es-core/src/components/RatingComponent.h index 220f58458..b0ebe872d 100644 --- a/es-core/src/components/RatingComponent.h +++ b/es-core/src/components/RatingComponent.h @@ -61,6 +61,7 @@ private: bool mColorizeChanges; bool mOverlay; + bool mHideIfZero; }; #endif // ES_APP_COMPONENTS_RATING_COMPONENT_H