made gauges react properly to mouse clicks. this was very hard given irrlicht's skin system, so a consequence is that you can make the slider move by clicking slighlty next to it; probably not too important

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3404 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-04-19 00:58:07 +00:00
parent 966e3563ce
commit 3e285d2e56
3 changed files with 18 additions and 11 deletions

View File

@ -442,14 +442,6 @@ void Skin::drawSpinnerChild(const core::rect< s32 > &rect, Widget* widget, const
spinner->x + spinner->w,
spinner->y + spinner->h );
//std::cout << "proceeding to render " << areas << std::endl;
#if 0
drawBoxFromStretchableTexture(rect2, m_tex_fspinner,
left_border, right_border,
border_above, border_below,
true /* horizontal aspect ratio kept */,
0, LEFT | RIGHT);
#endif
drawBoxFromStretchableTexture(rect2, m_tex_dspinner,
left_border, right_border,
border_above, border_below,
@ -471,14 +463,21 @@ void Skin::drawGauge(const core::rect< s32 > &rect, Widget* widget, bool focused
drawBoxFromStretchableTexture(rect, (focused ? m_tex_fspinner : m_tex_spinner),
left_border, right_border,
border_above, border_below,
true /* horizontal aspect ratio kept */, 0);
false /* horizontal aspect ratio kept */, -0.9);
}
void Skin::drawGaugeFill(const core::rect< s32 > &rect, Widget* widget, bool focused)
{
// FIXME - move these numbers to a config file
const int left_border = 110;
//const int right_border = 110;
//const int border_above = 0;
//const int border_below = 36;
GaugeWidget* w = dynamic_cast<GaugeWidget*>(widget);
// the width of an handle is about 0.844 the height in the current skin. FIXME - don't hardcode.
const int handle_size = (int)(widget->h*0.844f);
const int handle_size = (int)(widget->h*0.844f) + left_border*0.2;
// the 'rect' argument will be too small, because irrlicht has no suitable gauge component, so i used a scrollbar
const core::rect< s32 > dest_area = core::rect< s32 >(widget->x+handle_size, widget->y,

View File

@ -38,12 +38,15 @@ class Skin : public IGUISkin
ITexture* m_tex_ficonhighlight;
ITexture* m_tex_squarefocus;
ITexture* m_tex_gaugefill;
ITexture* m_tex_gauge;
ITexture* m_tex_checkbox;
ITexture* m_tex_fcheckbox;
ITexture* m_tex_dcheckbox;
ITexture* m_tex_dfcheckbox;
void drawBoxFromStretchableTexture(const core::rect< s32 > &dest, ITexture* source,
const int left_border, const int right_border,
const int top_border, const int bottom_border,

View File

@ -282,7 +282,12 @@ bool CheckBoxWidget::transmitEvent(Widget* w, std::string& originator)
void GaugeWidget::add()
{
rect<s32> widget_size = rect<s32>(x, y, x + w, y + h);
m_element = GUIEngine::getGUIEnv()->addScrollBar(true /* horizontal */, widget_size, NULL, ++id_counter);
IGUIScrollBar* sb = GUIEngine::getGUIEnv()->addScrollBar(true /* horizontal */, widget_size, NULL, ++id_counter);
sb->setMax(100);
sb->setSmallStep(10);
sb->setLargeStep(10);
m_element = sb;
id = m_element->getID();
m_element->setTabOrder(id);