SDL Digest, Vol 28, Issue 7

Oops. Sorry about the double-post.

I can’t seem to get the SDL_CreateCursor code working correctly.
On what platform is this?
Mac OSX, but the same exact problem occurs when I compiled it on
windows.

Does anyone have a link to some code that actually demonstrates it
correctly?
http://libsdl.org/cgi/viewvc.cgi/branches/SDL-1.2/test/testcursor.c?
view=markup
-Christian

I tried those 3 examples from that page.
SDL_CreateCursor((Uint8 *)cursor_data, (Uint8 *)cursor_mask,16, 16,
8, 8);
produced a weird pattern like a square with the bottom right quadrant
missing. It had weird transparency too.

cursor[2] = SDL_CreateCursor(small_cursor_data, small_cursor_mask,8,
11, 3, 5);
resulted in a weird circle with a dot in the center and a squiggle on
the top and bottom of it. It looked weird, but I think that may have
been what it was supposed to look like.

cursor[1] = create_arrow_cursor();
This resulted in the exact same image I got before:

What could possibly cause this?

Trevor Agnitti wrote:

I can’t seem to get the SDL_CreateCursor code working correctly.
On what platform is this?
Mac OSX, but the same exact problem occurs when I compiled it on windows.

I can’t help you with Windows, but the current Mac OS X implementation
of SDL_CreateCursor works as expected here (at least in the cases tested
by testcursor.c) - which is no surprise because I wrote it. Could it be
that you’re not using the latest version of SDL (1.2.11)? The Mac OS X
implementation of SDL_CreateCursor was broken in earlier versions
(though I don’t remember if the symptoms were exactly the ones you’re
describing).

Does anyone have a link to some code that actually demonstrates it
correctly?
http://libsdl.org/cgi/viewvc.cgi/branches/SDL-1.2/test/testcursor.c?view=markup

I tried those 3 examples from that page.
SDL_CreateCursor((Uint8 *)cursor_data, (Uint8 *)cursor_mask,16, 16, 8, 8);
produced a weird pattern like a square with the bottom right quadrant
missing. It had weird transparency too.

That’s the intended result. It’s even described in the comments at the
top of testcursor.c. (And the “weird transparency”, which is completely
correct according to the specification
http://libsdl.org/cgi/docwiki.cgi/SDL_5fCreateCursor, suggests you’re
indeed using SDL 1.2.10 or earlier - unfortunately it’s not possible
anymore in the new cursor code I wrote for 1.2.11.)

cursor[2] = SDL_CreateCursor(small_cursor_data, small_cursor_mask,8, 11,
3, 5);
resulted in a weird circle with a dot in the center and a squiggle on
the top and bottom of it. It looked weird, but I think that may have
been what it was supposed to look like.

:slight_smile: Yes, it’s indeed supposed to look like this. I designed that cursor
to have unusual width and height, and the squiggles are there to make it
asymmetric to make sure it wouldn’t come out flipped. I should probably
have included a description in the comment there, especially as the hex
encoding isn’t particularly human-readable.

-Christian