Fixed a small issue. The main issue is still the bad allignment of the widget though.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13398 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
a4c5c4b8ec
commit
f4c7cf439e
@ -67,20 +67,19 @@ int RatingBarWidget::getStepsOfStar(int index)
|
|||||||
|
|
||||||
void RatingBarWidget::setStepValues(float float_rating)
|
void RatingBarWidget::setStepValues(float float_rating)
|
||||||
{
|
{
|
||||||
int rating = round(float_rating);
|
|
||||||
float step_size = 1 / (float)(m_steps - 1);
|
float step_size = 1 / (float)(m_steps - 1);
|
||||||
|
|
||||||
for (int star = 0; star < m_stars; star++)
|
for (int star = 0; star < m_stars; star++)
|
||||||
{
|
{
|
||||||
if (rating < star)
|
if (float_rating < star)
|
||||||
m_star_values[star] = 0;
|
m_star_values[star] = 0;
|
||||||
else if (rating > star + 1)
|
else if (float_rating > star + 1)
|
||||||
m_star_values[star] = m_steps-1;
|
m_star_values[star] = m_steps-1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int step = 0; step < m_steps; step++)
|
for (int step = 0; step < m_steps; step++)
|
||||||
{
|
{
|
||||||
if (rating > star + step_size * (step - 0.5) && rating < star + step_size * (step + 0.5))
|
if (float_rating > star + step_size * (step - 0.5) && float_rating < star + step_size * (step + 0.5))
|
||||||
{
|
{
|
||||||
m_star_values[star] = step;
|
m_star_values[star] = step;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user