mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Use RatingComponent in the metadata editor.
This commit is contained in:
parent
fb8bfc9486
commit
153aee5040
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue