SFML community forums

Help => Window => Topic started by: DasOhmoff San on December 23, 2015, 10:28:53 pm

Title: Get mouse position based on view. (sf::Mouse::getPosition(window) does not work)
Post by: DasOhmoff San on December 23, 2015, 10:28:53 pm
Using sf::View and sf::Mouse::getPosition(window) does not work together.
I get false values with sf::Mouse::getPosition(window).

I think it is because my view and my window does not have the same size.
And I cannot use window.getGlobalBounds().contains(sf::Mouse::getPosition(window)) too
because of this.

How to fix this?
Title: Re: Get mouse position based on view. (sf::Mouse::getPosition(window) does not work)
Post by: Laurent on December 23, 2015, 10:38:12 pm
http://www.sfml-dev.org/tutorials/2.3/graphics-view.php#coordinates-conversions
Title: Re: Get mouse position based on view. (sf::Mouse::getPosition(window) does not work)
Post by: DasOhmoff San on December 24, 2015, 05:43:06 pm
http://www.sfml-dev.org/tutorials/2.3/graphics-view.php#coordinates-conversions

Thanks a lot, this solved the problem.