Ratings are now themable.

This commit is contained in:
Aloshi 2014-01-19 17:37:08 -06:00
parent 43972c5be9
commit 5606a07f88
3 changed files with 24 additions and 0 deletions

View file

@ -50,6 +50,11 @@ std::map< std::string, std::map<std::string, ThemeData::ElementPropertyType> > 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));

View file

@ -111,3 +111,19 @@ bool RatingComponent::input(InputConfig* config, Input input)
return GuiComponent::input(config, input);
}
void RatingComponent::applyTheme(const std::shared_ptr<ThemeData>& 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<std::string>("filledPath"), true);
if(properties & PATH && elem->has("unfilledPath"))
mUnfilledTexture = TextureResource::get(elem->get<std::string>("unfilledPath"), true);
}

View file

@ -15,6 +15,9 @@ public:
void render(const Eigen::Affine3f& parentTrans);
void onSizeChanged() override;
virtual void applyTheme(const std::shared_ptr<ThemeData>& theme, const std::string& view, const std::string& element, unsigned int properties) override;
private:
void updateVertices();