Getting mouse position correctly with varible window size?
Posted: Mon Feb 28, 2011 4:47 pm
I need to have the mouse interact with stuff in the visualiser window for a grid editor,. I am using this to move my zge pointer and 'know' where it is;
However with the window being resizeable and with varying aspect means the desktop pointer does not line up with the zge one. Is there some way to easily get the actual mouse position to line up?
We have these app.ViewportRatio , app.ViewportWidth, app.ViewportHeight,. however I have not found any solid relationship to do some transformation that sticks it. This makes building interface elements in the 3d window sorta tough,. .
Code: Select all
pointer.Translate.x=clamp(App.MousePosition.x*16,-8,7);
pointer.Translate.y=clamp(App.MousePosition.y*16,-8,7);
We have these app.ViewportRatio , app.ViewportWidth, app.ViewportHeight,. however I have not found any solid relationship to do some transformation that sticks it. This makes building interface elements in the 3d window sorta tough,. .