I want to implement a first person camera, so I need to figure out the mouse movement.
Therefore my function listens to the "MouseMoved" event. When triggered I calculate the offset of the new mouse position to the center of the window. Then I set the mouse position back to the center of the window. So I get the mouse position delta each frame the mouse moved.
Vector2i center(window->getSize().x / 2, window->getSize().y / 2);
Vector2i delta = Vector2i(event.mouseMove.x, event.mouseMove.y) - center;
Mouse::setPosition(center, *window);
Unfortunately this results in an endless circle since "setPosition" triggers the "MouseMoved" event again and my function is executes over and over.
How can I set the mouse position without triggering the "MouseMoved" event?