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

Author Topic: sf::Mouse Coordinates relative to window but not locked inside window border?  (Read 1130 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 1
    • View Profile
Is there a way to do this (title)? In glfw there is a way to get the coordinates of the mouse position without binding the mouse inside of the window border (glfw window not sfml window) or monitor edges. I know there is a function in the sf::RenderWindow class called setMouseCursorGrabbed(boolean) and that works to get the coordinates of the mouse relative to the window but it locks the mouse inside of some border.

If this isn't somehow manageable to do with sfml then how would one use the mouse callback from glfw with an sfml sf::RenderWindow?


  • SFML Team
  • Hero Member
  • *****
  • Posts: 10190
    • View Profile
    • development blog
    • Email
SFML doesn't have such a relative mode (yet). But a similar effect can be achieved by resetting the mouse position to the middle of the window every frame and using the difference as relative movement variable.

As for GLFW and SFML interaction, I doubt it's possible. You can always try, but then you're left to your own devices.

Also please use the help section for questions. The bindings forum is really just for discussions about SFML bindings. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/