How to set mouse position with a floating point value ?

compvis

06-01-2010 03:36:42

hi,

I want to set mouse position with a floating point value (range from 0 to 1) but i couldn't, MyGui only supports INT value,

How can i do with other way ?

Thanks

my.name

06-01-2010 04:00:59

const MyGUI::IntSize& view_size = MyGUI::Gui::getInstance().getViewSize();
float x_rel = 0.5;
int x = (int)((float)view_size.width * x_rel);

compvis

06-01-2010 09:57:01

Ha ha, thank you so much !

BTW: I suggest a function, such as, MyGui::InputManager::getInstancePtr()->setMousePosition(Real x, Real y);

xypher

06-05-2010 02:58:46

I would agree, except that apparently MyGUI uses this internally as (int, int) for mouse position anyhow. Wouldn't hurt to have a utility function, but its such a minor issue I would certainly not complain should the MyGUI team decide not to implement it. :)