Quick commit to save my progress as my internet connection is clearly unstable
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13407 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
f4c7cf439e
commit
ed689232e0
@ -815,9 +815,6 @@ void Skin::drawRatingBar(Widget *w, const core::recti &rect,
|
|||||||
{
|
{
|
||||||
RatingBarWidget *ratingBar = (RatingBarWidget*)w;
|
RatingBarWidget *ratingBar = (RatingBarWidget*)w;
|
||||||
|
|
||||||
core::position2d<s32> mouse_position = irr_driver->getDevice()->getCursorControl()->getPosition();
|
|
||||||
ratingBar->setStepValuesByMouse(mouse_position);
|
|
||||||
|
|
||||||
const ITexture *texture = SkinConfig::m_render_params["rating::neutral"].getImage();
|
const ITexture *texture = SkinConfig::m_render_params["rating::neutral"].getImage();
|
||||||
const int texture_w = texture->getSize().Width / 4;
|
const int texture_w = texture->getSize().Width / 4;
|
||||||
const int texture_h = texture->getSize().Height;
|
const int texture_h = texture->getSize().Height;
|
||||||
@ -839,6 +836,10 @@ void Skin::drawRatingBar(Widget *w, const core::recti &rect,
|
|||||||
const int x_from = rect.UpperLeftCorner.X + (rect.getWidth() - star_w) / 2;
|
const int x_from = rect.UpperLeftCorner.X + (rect.getWidth() - star_w) / 2;
|
||||||
const int y_from = rect.UpperLeftCorner.Y + (rect.getHeight() - star_h) / 2;
|
const int y_from = rect.UpperLeftCorner.Y + (rect.getHeight() - star_h) / 2;
|
||||||
|
|
||||||
|
core::recti stars_rect(x_from, y_from, x_from + (star_number * star_w), y_from + star_h);
|
||||||
|
|
||||||
|
ratingBar->setStepValuesByMouse(irr_driver->getDevice()->getCursorControl()->getPosition(), stars_rect);
|
||||||
|
|
||||||
for (int i = 0; i < star_number; i++)
|
for (int i = 0; i < star_number; i++)
|
||||||
{
|
{
|
||||||
core::recti star_rect = rect;
|
core::recti star_rect = rect;
|
||||||
|
@ -99,14 +99,12 @@ void RatingBarWidget::setRating(float rating)
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
void RatingBarWidget::setStepValuesByMouse(const core::position2d<s32> & mouse_position)
|
void RatingBarWidget::setStepValuesByMouse(const core::position2d<s32> & mouse_position, const core::recti & stars_rect)
|
||||||
{
|
{
|
||||||
if(m_element->getAbsolutePosition().isPointInside(mouse_position))
|
if(stars_rect.isPointInside(mouse_position))
|
||||||
{
|
{
|
||||||
|
float value = (float)(mouse_position.X - stars_rect.UpperLeftCorner.X);
|
||||||
float value = (float)(mouse_position.X - m_element->getAbsolutePosition().UpperLeftCorner.X);
|
setStepValues( (float)( value / (float)stars_rect.getWidth() * (float)m_stars) );
|
||||||
setStepValues( (float)( value / (float)m_w * (float)m_stars) );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ namespace GUIEngine
|
|||||||
|
|
||||||
int getStepsOfStar(int index);
|
int getStepsOfStar(int index);
|
||||||
|
|
||||||
void setStepValuesByMouse(const core::position2d<s32> & mouse_position);
|
void setStepValuesByMouse(const core::position2d<s32> & mouse_position, const core::recti & stars_rect);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user