I am trying to set a custom SDL cursor from a raw RGBA8888 byte array. The handle creation successfully works, as it returns a valid SDL surface handle, but trying to set the cursor using SDL_SetCursor does nothing, like does not change the cursor.
The SDL_SetCursor does not return a value etiher so I just manually tried to print the error code using SDL_GetError() and it says: “Cursor not associated with the current mouse”
What does this mean?
Thanks for any help.
As a note, I found where it sets the error: SDL/SDL_mouse.c at 92b3c53c92971e685254fd89f89ce6bde8cea60e · libsdl-org/SDL · GitHub
Although this still does not make sense for me, and it is weird that this function does not return any value but setting the error code.
It sounds like you want to call SDL_CreateColorCursor() with your surface and then use the returned cursor instead of passing the surface directly to SDL_SetCursor().
I totally did not notice that, that worked.