I better throw this out to those people who is eager to use it in their games.
Unfortunately it's only implemented for windows. Reason is because I am not familiar with any other OS.
You will have to build SFML by yourself and replace some files under in the windows module.
It is used like this:
sf::RenderWindow window(sf::VideoMode(1920, 1080), "Title");
window.setRelativeMouseMode(true);
Then you can capture a new event called MouseMotion
if (event.type == sf::Event::MouseMotion)
{
event.mouseMotion.x; // Delta x
event.mouseMotion.y; // Delta y
}
Github repository & download: https://github.com/doodlemeat/SFML-2.1-RAWINPUT
Thoughts?
I have updated the repository to support multiple mouse devices, since I have seen some people wanting that.
Each mouse device have a unique ID. The ID comes with sf::Event::MouseMotion. The ID is received in what order the mice are plugged into the computer. Be aware of that because I had a hard time figuring this out with a game I developed that used ManyMouse script.
This is how you can identify mice.
if (event.type == sf::Event::MouseMotion)
{
if (event.mouseMotion.index == 0) // Player 1
{
// Action
event.mouseMotion.x;
event.mouseMotion.y;
}
else if (event.mouseMotion.index == 1) // Player 2
{
// Action
event.mouseMotion.x;
event.mouseMotion.y;
}
}
For example: Give each player a mouse id and you can easily check wether or not the you have received an event from that mouse.