I create a render window and set its size to 600 by 600 and whenever I move the window around I get different mouse.getPosition and I was wondering if there is a way to stop this from happening and just make the top left corner 0 for x and 0 for y?
SFML getting mouse position
From the documentation.
sf::Mouse::getPosition() gets the mouse position in desktop coordinates.
sf::Mouse::getPosition( Window& ) gets the mouse position relative to the window.
From your description, it looks like you are using the first one but want to be using the second one. Pass in your game window to get the mouse position relative to your window.
Just remember the prefered way in SFML is to use sf::Window::pollEvent in a loop and check all input events it gives you anyway.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement