

Update: SFML 2.5 introduced support for system cursor, as such it’s recommended to use that instead of the following code. tPosition(static_cast(sf::Mouse::getPosition(window))) // Set position Sf::View fixed = window.getView() // Create a fixed view tMouseCursorVisible(false) // Hide cursor Sf::RenderWindow window(sf::VideoMode(800, 600), "Hidden Cursor") Since it’s so simple there’s not more to talk about and an example shows a possible implementation: (optional) Adjust the view to get the correct render position.Set the position of the sprite to the position of the mouse.Use sf::RenderWindow::setMouseCursorVisible(bool) to hide the cursor.This task is fairly simple, it consists out of three required and one optional tasks: Since I won’t go into details regarding C++ or SFML, the tutorial requires you to have some basic knowledge on both topics. You’ll need SFML, an editor and a compiler (obviously these links are only suggestions). You can hide the default cursor and draw a sprite where the cursor should be.There are two ways to change your cursor: If you’re making an application or game, you might want to be able to display a different cursor. Since SFML is not a framework nor a GUI system providing a native function for changing the mouse cursor doesn’t fit its purpose. For example you’ll get a selection cursor when hovering over a text or a hand shaped cursor could indicate a link etc. Next to the functionality like pointing and clicking the cursor can show many different states and indicate possible actions. The cursor is something every computer user is familiar with and in fact is constantly staring at, yet many people don’t even realize anymore that it’s there and changes its shape every so often. I’ve just published my first tutorial with SFML, okay it’s actually not fully my tutorial since I’ve partially rewritten one from the old section, but expanded it with in my opinion a better solution.Īlthough you can find the tutorial on the wiki site of SFML, I post it here again.
