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

Author Topic: Can MouseButtonPressed have different x, and y values than previous MouseMoved?  (Read 756 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 7
    • View Profile
A simple question just reworded:

Is it possible for a MouseButtonPressed event to have different x, and y positions for the mouse's coordinates than the previous MouseMove event?

Answer: Yes


  • SFML Team
  • Hero Member
  • *****
  • Posts: 10783
    • View Profile
    • development blog
    • Email
The events are fired independently, so we can't/shouldn't make any assumptions.

Just as an example, again not to make any assumptions on the order or relation between the events, you could get the follow event queue:

MouseMoved (x: 10, y: 20)
MouseButtonPressed (x: 11, y: 20)
MouseMoved (x: 11, y: 20)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
Dev Blog: https://duerrenberger.dev/blog/