Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf::Mouse::getPosition slightly off  (Read 1408 times)

0 Members and 1 Guest are viewing this topic.

nicktlloyd

  • Newbie
  • *
  • Posts: 7
    • View Profile
sf::Mouse::getPosition slightly off
« on: April 20, 2016, 07:56:18 pm »
I'm using:
   sf::Vector2i pixelPos = sf::Mouse::getPosition(*this);
   sf::Vector2f worldPos = this->mapPixelToCoords(pixelPos);
to get the position of mouse clicks within a world. When I draw draw things based on these coordinates, everything is drawing slightly higher than where the mouse actually was. This is consistent no matter how I change the view, it's always off by the same amount. If I resize the window, it's off in both axis' by more, consistently. I know this is somewhat vague, as the code for the window is spread out across three or four classes. I'm just wondering if there is a sample program out there that deals with window resizes so I can see what's going on. Thanks!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: sf::Mouse::getPosition slightly off
« Reply #1 on: April 20, 2016, 08:44:00 pm »
Create a minimal example and test with that instead of your work in progress.
Do you change the view?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything