Use RatingComponent in the metadata editor.

This commit is contained in:
Aloshi 2013-09-24 14:44:18 -05:00
parent fb8bfc9486
commit 153aee5040
3 changed files with 26 additions and 0 deletions

View file

@ -1,7 +1,9 @@
#include "MetaData.h"
#include "components/TextComponent.h"
#include "Log.h"
#include "components/TextEditComponent.h"
#include "components/RatingComponent.h"
MetaDataList::MetaDataList()
{
@ -98,6 +100,11 @@ GuiComponent* MetaDataList::makeDisplay(Window* window, MetaDataType as)
{
switch(as)
{
case MD_RATING:
{
RatingComponent* comp = new RatingComponent(window);
return comp;
}
default:
TextComponent* comp = new TextComponent(window);
return comp;
@ -108,6 +115,11 @@ GuiComponent* MetaDataList::makeEditor(Window* window, MetaDataType as)
{
switch(as)
{
case MD_RATING:
{
RatingComponent* comp = new RatingComponent(window);
return comp;
}
case MD_MULTILINE_STRING:
{
TextEditComponent* comp = new TextEditComponent(window);

View file

@ -92,3 +92,16 @@ void RatingComponent::render(const Eigen::Affine3f& parentTrans)
renderChildren(trans);
}
bool RatingComponent::input(InputConfig* config, Input input)
{
if(config->isMappedTo("a", input) && input.value != 0)
{
mValue += 0.2f;
if(mValue > 1.0f)
mValue = 0.0f;
updateVertices();
}
return GuiComponent::input(config, input);
}

View file

@ -11,6 +11,7 @@ public:
std::string getValue() const override;
void setValue(const std::string& value) override;
bool input(InputConfig* config, Input input) override;
void render(const Eigen::Affine3f& parentTrans);
void onSizeChanged() override;