mirror of
				https://github.com/RetroDECK/ES-DE.git
				synced 2025-04-10 19:15:13 +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}, |        {"rotation", FLOAT}, | ||||||
|        {"rotationOrigin", NORMALIZED_PAIR}, |        {"rotationOrigin", NORMALIZED_PAIR}, | ||||||
|        {"stationary", STRING}, |        {"stationary", STRING}, | ||||||
|  |        {"hideIfZero", BOOLEAN}, | ||||||
|        {"gameselector", STRING}, |        {"gameselector", STRING}, | ||||||
|        {"gameselectorEntry", UNSIGNED_INTEGER}, |        {"gameselectorEntry", UNSIGNED_INTEGER}, | ||||||
|        {"interpolation", STRING}, |        {"interpolation", STRING}, | ||||||
|  |  | ||||||
|  | @ -21,6 +21,7 @@ RatingComponent::RatingComponent(bool colorizeChanges, bool linearInterpolation) | ||||||
|     , mColorChangedValue {mMenuColorPrimary} |     , mColorChangedValue {mMenuColorPrimary} | ||||||
|     , mColorizeChanges {colorizeChanges} |     , mColorizeChanges {colorizeChanges} | ||||||
|     , mOverlay {true} |     , mOverlay {true} | ||||||
|  |     , mHideIfZero {false} | ||||||
| { | { | ||||||
|     mSize = glm::vec2 {std::round(mRenderer->getScreenHeight() * 0.06f) * NUM_RATING_STARS, |     mSize = glm::vec2 {std::round(mRenderer->getScreenHeight() * 0.06f) * NUM_RATING_STARS, | ||||||
|                        std::round(mRenderer->getScreenHeight() * 0.06f)}; |                        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) |     if (!isVisible() || mThemeOpacity == 0.0f || mOpacity == 0.0f) | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|  |     if (mHideIfZero && mValue == 0.0f) | ||||||
|  |         return; | ||||||
|  | 
 | ||||||
|     glm::mat4 trans {parentTrans * getTransform()}; |     glm::mat4 trans {parentTrans * getTransform()}; | ||||||
| 
 | 
 | ||||||
|     mIconUnfilled.setOpacity(mOpacity * mThemeOpacity); |     mIconUnfilled.setOpacity(mOpacity * mThemeOpacity); | ||||||
|  | @ -227,6 +231,9 @@ void RatingComponent::applyTheme(const std::shared_ptr<ThemeData>& theme, | ||||||
|                             << element.substr(7) << "\" defined as \"" << stationary << "\""; |                             << element.substr(7) << "\" defined as \"" << stationary << "\""; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     if (elem->has("hideIfZero")) | ||||||
|  |         mHideIfZero = elem->get<bool>("hideIfZero"); | ||||||
|  | 
 | ||||||
|     bool linearInterpolation {false}; |     bool linearInterpolation {false}; | ||||||
| 
 | 
 | ||||||
|     // Enable linear interpolation by default if element is arbitrarily rotated.
 |     // Enable linear interpolation by default if element is arbitrarily rotated.
 | ||||||
|  |  | ||||||
|  | @ -61,6 +61,7 @@ private: | ||||||
| 
 | 
 | ||||||
|     bool mColorizeChanges; |     bool mColorizeChanges; | ||||||
|     bool mOverlay; |     bool mOverlay; | ||||||
|  |     bool mHideIfZero; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #endif // ES_APP_COMPONENTS_RATING_COMPONENT_H
 | #endif // ES_APP_COMPONENTS_RATING_COMPONENT_H
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Leon Styhre
						Leon Styhre