SFML community forums
Help => General => Topic started by: slotdev on June 01, 2011, 10:49:36 am
-
Hi
Is there a way to automatically have SFML tell me the co-ordinates of the mouse, when I have a large window and all graphics are being scaled?
eg. I have a button at X=100, Y=100 (at 1024x768) but at 1280x1024 it's (of course) at a different position on the screen.
Thanks
-
window.ConvertCoords(mouseX, mouseY);
-
Genius!
Thanks :D
-
I check for events
myWindow.ConvertCoords(Event.MouseMove.X,Event.MouseMove.Y);
eventData.clickPosX = mousePos.x; // Might need a cast
eventData.clickPosY = mousePos.y;
Where are these lines located in your code?
And you're not storing the result of the function.