SFML community forums

Help => General => Topic started by: 6Peppered9 on December 02, 2018, 01:33:30 pm

Title: Need help to change the mouse cursor
Post by: 6Peppered9 on December 02, 2018, 01:33:30 pm
Hello,
I want to change my mouse pointer in my SFML application. (using SFML 2.5.1 on Linux)

I have used the following steps from the documentation:
sf::Cursor cursor;
cursor.loadFromPixels(image.getPixelsPtr(), image.getSize(), {0, 0});
window.setMouseCursor(cursor);
 

The image I want to use as a mouse pointer is a red rectangle in PNG format
(https://i.imgur.com/OwL0ffg.png)

When I start the application, the mouse pointer is rendered strange.

(https://i.imgur.com/aComAJf.jpg)

Instead of the white lines, the mouse pointer should normally be displayed.

Do I lose any data when loading the image, so I get such an output?