diff --git a/src/ThemeData.cpp b/src/ThemeData.cpp index 0eb9d9795..e59937180 100644 --- a/src/ThemeData.cpp +++ b/src/ThemeData.cpp @@ -50,6 +50,11 @@ std::map< std::string, std::map > T ("color", COLOR) ("fontPath", PATH) ("fontSize", FLOAT)) + ("rating", boost::assign::map_list_of + ("pos", NORMALIZED_PAIR) + ("size", NORMALIZED_PAIR) + ("filledPath", PATH) + ("unfilledPath", PATH)) ("sound", boost::assign::map_list_of ("path", PATH)); diff --git a/src/components/RatingComponent.cpp b/src/components/RatingComponent.cpp index c49b6336f..f5aa705a9 100644 --- a/src/components/RatingComponent.cpp +++ b/src/components/RatingComponent.cpp @@ -111,3 +111,19 @@ bool RatingComponent::input(InputConfig* config, Input input) return GuiComponent::input(config, input); } + +void RatingComponent::applyTheme(const std::shared_ptr& theme, const std::string& view, const std::string& element, unsigned int properties) +{ + GuiComponent::applyTheme(theme, view, element, properties); + + using namespace ThemeFlags; + + const ThemeData::ThemeElement* elem = theme->getElement(view, element, "rating"); + if(!elem) + return; + + if(properties & PATH && elem->has("filledPath")) + mFilledTexture = TextureResource::get(elem->get("filledPath"), true); + if(properties & PATH && elem->has("unfilledPath")) + mUnfilledTexture = TextureResource::get(elem->get("unfilledPath"), true); +} diff --git a/src/components/RatingComponent.h b/src/components/RatingComponent.h index bf2ce2071..5a40e741b 100644 --- a/src/components/RatingComponent.h +++ b/src/components/RatingComponent.h @@ -15,6 +15,9 @@ public: void render(const Eigen::Affine3f& parentTrans); void onSizeChanged() override; + + virtual void applyTheme(const std::shared_ptr& theme, const std::string& view, const std::string& element, unsigned int properties) override; + private: void updateVertices();