How to change mouse cursor icon

Hello sdl,

i am talking abount this standard b&w.
when i change it in included file nothing happens…–
Best regards,
firefox mailto:@palpetine

Okresl Swoje potrzeby - my znajdziemy oferte za Ciebie!
[ http://oferty.onet.pl ]

I’ve done this once in SDL. :slight_smile: I used “SDL_SetCursor()” to change
the appearance of the cursor in my game “Bug Squish” to look like a little
fly-swatter.

First off, I included two XBM images in my C code:

#include “flyswatter.xbm” (black will be black, white will be white)
#include “flyswatter-mask.xbm” (black will be opaque, white will be
transparent)

I then did this crud to, it appears, reverse the bits in each byte.
I forget why, at this point. I’ve not heard any complaints, so I assume
it works ok :slight_smile:

for (i = 0; i < 32; i++)
{
b = flyswatter_bits[i];

  temp_bitmap[i] = (((b & 0x01) << 7) |
                    ((b & 0x02) << 5) |
                    ((b & 0x04) << 3) |
                    ((b & 0x08) << 1) |
                    ((b & 0x10) >> 1) |
                    ((b & 0x20) >> 3) |
                    ((b & 0x40) >> 5) |
                    ((b & 0x80) >> 7));

  b = flyswatter_mask_bits[i];

  temp_bitmask[i] = (((b & 0x01) << 7) |
                     ((b & 0x02) << 5) |
                     ((b & 0x04) << 3) |
                     ((b & 0x08) << 1) |
                     ((b & 0x10) >> 1) |
                     ((b & 0x20) >> 3) |
                     ((b & 0x40) >> 5) |
                     ((b & 0x80) >> 7));
}

Finally, I call SDL_SetCursor():

SDL_SetCursor(SDL_CreateCursor(temp_bitmap, temp_bitmask, 16, 16, 0, 0));

Bug Squish source is here: http://www.newbreedsoftware.com/bugsquish/

-bill!On Thu, Mar 14, 2002 at 03:14:25PM +0100, firefox wrote:

Hello sdl,

i am talking abount this standard b&w.
when i change it in included file nothing happens…