Search code examples
c++openglsfmlmultiplatform

How can I change the position of the mouse cursor in OpenGL/SFML?


I'm writing a simple FPS game and I'm going to have the mouse control the camera. I'm using SFML library for C++. How can i set mouse position to the center of the window. Can you help me to find multiplatform version of the setCursorPos (Windows only)

// Sorry for my bad english


Solution

  • You can use:

    • sf::Window::SetCursorPosition for SFML 1.6
    • sf::Mouse::SetPosition for SFML 2.0