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:
Aloshi 2014-04-27 22:03:55 -05:00
parent 2abc4f2f3a
commit fc96849f08
2 changed files with 15 additions and 7 deletions

View file

@ -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)

View file

@ -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: