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:
parent
966e3563ce
commit
3e285d2e56
@ -442,14 +442,6 @@ void Skin::drawSpinnerChild(const core::rect< s32 > &rect, Widget* widget, const
|
|||||||
spinner->x + spinner->w,
|
spinner->x + spinner->w,
|
||||||
spinner->y + spinner->h );
|
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,
|
drawBoxFromStretchableTexture(rect2, m_tex_dspinner,
|
||||||
left_border, right_border,
|
left_border, right_border,
|
||||||
border_above, border_below,
|
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),
|
drawBoxFromStretchableTexture(rect, (focused ? m_tex_fspinner : m_tex_spinner),
|
||||||
left_border, right_border,
|
left_border, right_border,
|
||||||
border_above, border_below,
|
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)
|
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);
|
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.
|
// 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
|
// 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,
|
const core::rect< s32 > dest_area = core::rect< s32 >(widget->x+handle_size, widget->y,
|
||||||
|
@ -38,12 +38,15 @@ class Skin : public IGUISkin
|
|||||||
ITexture* m_tex_ficonhighlight;
|
ITexture* m_tex_ficonhighlight;
|
||||||
ITexture* m_tex_squarefocus;
|
ITexture* m_tex_squarefocus;
|
||||||
ITexture* m_tex_gaugefill;
|
ITexture* m_tex_gaugefill;
|
||||||
|
ITexture* m_tex_gauge;
|
||||||
|
|
||||||
ITexture* m_tex_checkbox;
|
ITexture* m_tex_checkbox;
|
||||||
ITexture* m_tex_fcheckbox;
|
ITexture* m_tex_fcheckbox;
|
||||||
ITexture* m_tex_dcheckbox;
|
ITexture* m_tex_dcheckbox;
|
||||||
ITexture* m_tex_dfcheckbox;
|
ITexture* m_tex_dfcheckbox;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void drawBoxFromStretchableTexture(const core::rect< s32 > &dest, ITexture* source,
|
void drawBoxFromStretchableTexture(const core::rect< s32 > &dest, ITexture* source,
|
||||||
const int left_border, const int right_border,
|
const int left_border, const int right_border,
|
||||||
const int top_border, const int bottom_border,
|
const int top_border, const int bottom_border,
|
||||||
|
@ -282,7 +282,12 @@ bool CheckBoxWidget::transmitEvent(Widget* w, std::string& originator)
|
|||||||
void GaugeWidget::add()
|
void GaugeWidget::add()
|
||||||
{
|
{
|
||||||
rect<s32> widget_size = rect<s32>(x, y, x + w, y + h);
|
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();
|
id = m_element->getID();
|
||||||
m_element->setTabOrder(id);
|
m_element->setTabOrder(id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user