SDL_CreateColorCursor always returns "Cursor hot spot doesn't lie within cursor"

I am using the following code to load a 32x32 color cursor from a bitmap:

// cursor_surface obtained via SDL_CreateRGBSurfaceFrom()
sdl_cursor = SDL_CreateColorCursor(cursor_surface,
32, 32, 1, 1);

if (sdl_cursor != NULL)
{
SDL_SetCursor(sdl_cursor);
}
else
{
log(SDL_GetError());
}

This always returns NULL with the following error message: “Cursor hot spot
doesn’t lie within cursor”. I have tried various values between
(0,0)-(32,32) and they all return this error.

Am I doing something wrong? How can I define a custom cursor with SDL2?

This is with SDL 2.0.1 on Mac OS X 10.9.2.

Am I doing something wrong? How can I define a custom cursor with SDL2?

This is with SDL 2.0.1 on Mac OS X 10.9.2.

The attached program works for me with 2.0.2 (icon.bmp is just the one
from SDL’s “test” directory).

Can you try it? I built it from the command line with "gcc -o test
test.c sdl2-config --cflags --libs"

–ryan.

-------------- next part --------------
A non-text attachment was scrubbed…
Name: test.c
Type: text/x-csrc
Size: 1147 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20140311/d0aebcb2/attachment.c

Yes this is working, thanks. I was mixing up SDL_CreateCursor with
SDL_CreateColorCursor, ergo a PEBCAK issue :confused:

2014-03-12 1:34 GMT+01:00 Ryan C. Gordon :>

Am I doing something wrong? How can I define a custom cursor with SDL2?

This is with SDL 2.0.1 on Mac OS X 10.9.2.

The attached program works for me with 2.0.2 (icon.bmp is just the one
from SDL’s “test” directory).

Can you try it? I built it from the command line with “gcc -o test test.c
sdl2-config --cflags --libs

–ryan.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org