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 1530 times)

0 Members and 1 Guest are viewing this topic.

Kaspire

  • 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • 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
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything