Merge branch 'master' of github.com:supertuxkart/stk-code

This commit is contained in:
hiker 2015-03-11 14:47:00 +11:00
commit acd66f46ff
6 changed files with 72 additions and 17 deletions

View File

@ -583,13 +583,19 @@ bool AddonsManager::uninstall(const Addon &addon)
*/
void AddonsManager::saveInstalled()
{
//Put the addons in the xml file
//Manually because the irrlicht xml writer doesn't seem finished, FIXME ?
// Put the addons in the xml file
// Manually because the irrlicht xml writer doesn't seem finished, FIXME ?
std::ofstream xml_installed(m_file_installed.c_str());
//write the header of the xml file
// Write the header of the xml file
xml_installed << "<?xml version=\"1.0\"?>" << std::endl;
xml_installed << "<addons xmlns='http://stkaddons.net/'>"
// Get server address from config
std::string server = UserConfigParams::m_server_addons;
// Find the third slash (end of the domain)
std::string::size_type index = server.find('/');
index = server.find('/', index + 2) + 1; // Omit one slash
xml_installed << "<addons xmlns='" << server.substr(0, index) << "'>"
<< std::endl;
for(unsigned int i = 0; i < m_addons_list.getData().size(); i++)

View File

@ -313,9 +313,6 @@ void reportHardwareStats()
std::string vendor, renderer, full_version;
irr_driver->getOpenGLData(&vendor, &renderer, &full_version);
json.add("GL_VENDOR", vendor );
json.add("GL_RENDERER", renderer );
json.add("GL_VERSION", full_version );
json.add("gfx_drv_ver", "OpenGL "+vendor);
std::string card_name = vendor;

View File

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

View File

@ -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);
}
}
// -----------------------------------------------------------------------------

View File

@ -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 */

View File

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