mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-23 06:35:38 +00:00
Fixed input not getting passed to DateTimeComponents in GuiMetaDataEd.
Fixed vertex rounding for RatingComponent. Rating no longer "wiggles" as you change the value in GuiMetaDataEd.
This commit is contained in:
parent
2abc4f2f3a
commit
fc96849f08
|
@ -60,9 +60,9 @@ void RatingComponent::updateVertices()
|
||||||
{
|
{
|
||||||
const float numStars = NUM_RATING_STARS;
|
const float numStars = NUM_RATING_STARS;
|
||||||
|
|
||||||
const float h = getSize().y(); // is the same as a single star's width
|
const float h = round(getSize().y()); // is the same as a single star's width
|
||||||
const float w = h * mValue * numStars;
|
const float w = round(h * mValue * numStars);
|
||||||
const float fw = h * numStars;
|
const float fw = round(h * numStars);
|
||||||
|
|
||||||
mVertices[0].pos << 0.0f, 0.0f;
|
mVertices[0].pos << 0.0f, 0.0f;
|
||||||
mVertices[0].tex << 0.0f, 1.0f;
|
mVertices[0].tex << 0.0f, 1.0f;
|
||||||
|
@ -85,9 +85,6 @@ void RatingComponent::updateVertices()
|
||||||
mVertices[10].pos << fw, 0.0f;
|
mVertices[10].pos << fw, 0.0f;
|
||||||
mVertices[10].tex << numStars, 1.0f;
|
mVertices[10].tex << numStars, 1.0f;
|
||||||
mVertices[11] = mVertices[7];
|
mVertices[11] = mVertices[7];
|
||||||
|
|
||||||
for(int i = 0; i < 12; i++)
|
|
||||||
mVertices[i].pos = roundVector(mVertices[i].pos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RatingComponent::render(const Eigen::Affine3f& parentTrans)
|
void RatingComponent::render(const Eigen::Affine3f& parentTrans)
|
||||||
|
|
|
@ -62,8 +62,16 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
|
||||||
{
|
{
|
||||||
ed = std::make_shared<RatingComponent>(window);
|
ed = std::make_shared<RatingComponent>(window);
|
||||||
const float height = lbl->getSize().y() * 0.71f;
|
const float height = lbl->getSize().y() * 0.71f;
|
||||||
ed->setSize(height * 4.9f, height);
|
ed->setSize(0, height);
|
||||||
row.addElement(ed, false, true);
|
row.addElement(ed, false, true);
|
||||||
|
|
||||||
|
auto spacer = std::make_shared<GuiComponent>(mWindow);
|
||||||
|
spacer->setSize(Renderer::getScreenWidth() * 0.0025f, 0);
|
||||||
|
row.addElement(spacer, false);
|
||||||
|
|
||||||
|
// pass input to the actual RatingComponent instead of the spacer
|
||||||
|
row.input_handler = std::bind(&GuiComponent::input, ed.get(), std::placeholders::_1, std::placeholders::_2);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MD_DATE:
|
case MD_DATE:
|
||||||
|
@ -75,6 +83,9 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
|
||||||
spacer->setSize(Renderer::getScreenWidth() * 0.0025f, 0);
|
spacer->setSize(Renderer::getScreenWidth() * 0.0025f, 0);
|
||||||
row.addElement(spacer, false);
|
row.addElement(spacer, false);
|
||||||
|
|
||||||
|
// pass input to the actual DateTimeComponent instead of the spacer
|
||||||
|
row.input_handler = std::bind(&GuiComponent::input, ed.get(), std::placeholders::_1, std::placeholders::_2);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MD_TIME:
|
case MD_TIME:
|
||||||
|
|
Loading…
Reference in a new issue