Merge branch 'master' of github.com:supertuxkart/stk-code
This commit is contained in:
commit
18af0b1c11
@ -1374,9 +1374,9 @@ void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget,
|
||||
const core::recti source_area(0, 0, texture_w, texture_h);
|
||||
|
||||
draw2DImage(texture,
|
||||
dest_area, source_area,
|
||||
0 /* no clipping */, 0,
|
||||
true /* alpha */);
|
||||
dest_area, source_area,
|
||||
0 /* no clipping */, 0,
|
||||
true /* alpha */);
|
||||
|
||||
}
|
||||
|
||||
@ -1598,15 +1598,28 @@ void Skin::drawCheckBox(const core::recti &rect, Widget* widget, bool focused)
|
||||
SColor(100,255,255,255),
|
||||
SColor(100,255,255,255),
|
||||
SColor(100,255,255,255) };
|
||||
draw2DImage( texture, rect, source_area,
|
||||
0 /* no clipping */, colors,
|
||||
true /* alpha */);
|
||||
draw2DImage(texture, rect, source_area,
|
||||
0 /* no clipping */, colors,
|
||||
true /* alpha */);
|
||||
}
|
||||
else
|
||||
{
|
||||
draw2DImage( texture, rect, source_area,
|
||||
0 /* no clipping */, 0,
|
||||
true /* alpha */);
|
||||
draw2DImage(texture, rect, source_area,
|
||||
0 /* no clipping */, 0,
|
||||
true /* alpha */);
|
||||
}
|
||||
|
||||
|
||||
if (focused && widget->hasTooltip())
|
||||
{
|
||||
const core::position2di mouse_position =
|
||||
irr_driver->getDevice()->getCursorControl()->getPosition();
|
||||
|
||||
if (rect.isPointInside(mouse_position))
|
||||
{
|
||||
m_tooltip_at_mouse.push_back(true);
|
||||
m_tooltips.push_back(widget);
|
||||
}
|
||||
}
|
||||
} // drawCheckBox
|
||||
|
||||
@ -1842,7 +1855,7 @@ void Skin::drawTooltip(Widget* widget, bool atMouse)
|
||||
if (atMouse)
|
||||
{
|
||||
pos = irr_driver->getDevice()->getCursorControl()->getPosition()
|
||||
+ core::position2di(15, 15);
|
||||
+ core::position2di(10 - size.Width / 2, 20);
|
||||
}
|
||||
|
||||
core::recti r(pos, size);
|
||||
|
@ -432,3 +432,38 @@ void SpinnerWidget::setCustomText(const core::stringw& text)
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SpinnerWidget::onClick()
|
||||
{
|
||||
if (m_children[1].m_deactivated ||
|
||||
m_children[1].m_properties[PROP_ID] != "spinnerbody" ||
|
||||
!isGauge())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const core::position2di mouse_position
|
||||
= irr_driver->getDevice()->getCursorControl()->getPosition();
|
||||
|
||||
core::recti body_rect
|
||||
= m_children[1].getIrrlichtElement()->getAbsolutePosition();
|
||||
|
||||
if (body_rect.isPointInside(mouse_position))
|
||||
{
|
||||
float exact_hover = (float)((mouse_position.X -
|
||||
body_rect.UpperLeftCorner.X) /
|
||||
(float)body_rect.getWidth()) * (m_max-m_min);
|
||||
|
||||
float new_value_f = ((exact_hover * (m_max - m_min)) /
|
||||
(m_max - m_min)) + m_min;
|
||||
int new_value = (int)roundf(new_value_f);
|
||||
|
||||
if (new_value > m_max) new_value = m_max;
|
||||
if (new_value < m_min) new_value = m_min;
|
||||
|
||||
setValue(new_value);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -91,6 +91,9 @@ namespace GUIEngine
|
||||
|
||||
/** \brief implementing method from base class Widget */
|
||||
virtual EventPropagation leftPressed(const int playerID);
|
||||
|
||||
/** \brief implementing method from base class Widget */
|
||||
virtual void onClick();
|
||||
|
||||
/** When inferring widget size from its label length, this method will be called to
|
||||
* if/how much space must be added to the raw label's size for the widget to be large enough */
|
||||
|
@ -151,6 +151,7 @@ void OptionsScreenUI::init()
|
||||
CheckBoxWidget* difficulty = getWidget<CheckBoxWidget>("perPlayerDifficulty");
|
||||
assert( difficulty != NULL );
|
||||
difficulty->setState( UserConfigParams::m_per_player_difficulty );
|
||||
difficulty->setTooltip(_("Players can select handicapped (more difficult) profiles on the kart selection screen"));
|
||||
|
||||
CheckBoxWidget* show_login = getWidget<CheckBoxWidget>("show-login");
|
||||
assert( show_login!= NULL );
|
||||
|
Loading…
Reference in New Issue
Block a user