no, this isn't a thread on how to create one, i've figured that out myself
rather, this is one to see if any of you can figure out what's wrong with the code for one. basically, i've changed all the TaharezLook's Slider code so it would work horizontally, instead of vertically. however, when i drag the thumb left/right, it moves up/down (though it snaps back to place when i let it go), and i can't find out why! i've kept looking and looking but can't find out why, GAH!
i've attached the code so you can have a look and see if you can find the problem.
creating a horizontal slider - problems
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: creating a horizontal slider - problems
I'll have a look and get back to you a bit later on
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: creating a horizontal slider - problems
Okay
Two small mistakes...
In the updateThumb method:
becomes:
The main issue was you had the x and y co-ords round the wrong way The other change was to remove the inversion that is required for vertical bars with 0 at the bottom.
In the getValueFromThumb method
Becomes:
Required to remove the inversion mentioned above.
HTH
CE.
Two small mistakes...
In the updateThumb method:
Code: Select all
d_thumb->setPosition(Point(0, absoluteToRelativeX_impl(this, slideExtent - (fltVal * (slideExtent / posExtent)))));
becomes:
Code: Select all
d_thumb->setPosition(Point(absoluteToRelativeX_impl(this, (fltVal * (slideExtent / posExtent))), 0));
The main issue was you had the x and y co-ords round the wrong way The other change was to remove the inversion that is required for vertical bars with 0 at the bottom.
In the getValueFromThumb method
Code: Select all
return d_maxValue - (d_thumb->getAbsoluteXPosition() / (slideExtent / posExtent));
Becomes:
Code: Select all
return (d_thumb->getAbsoluteXPosition() / (slideExtent / posExtent));
Required to remove the inversion mentioned above.
HTH
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 2 guests