I am trying to create my own slider class which contains cegui::slider as a class member.
when the user clicks on the slider, I want the slider thumbnail to be set to the clicked point. To do that I need the absolute X position of the slider window and the absolute mouse click position.
here is the code I wrote
Code: Select all
bool handleMouseDown(const CEGUI::EventArgs& e)
{
const MouseEventArgs& m_evt = static_cast<const MouseEventArgs&>(e);
float mouse_abs_x = m_evt.position.d_x ;
float window_abs_x = m_evt.window->getXPosition().asAbsolute(800);
float val = mouse_abs_x - window_abs_x;
...
however value of window_abs_x is not correct (I am sure that application window width is 800). I couldnt find what the problem is. besides where can I get the 'base'.
thanks in advance and for your time.