Setting the Color Key

I’m new at SDL and writing my first program but I can’t figure out how to
set the color key. I have a bmp loaded on my surface “image” and i want the
colorkey to be RGB 0, 255, 0 (green) but I don’t understand what the Uint32
flag is or what to put there referring to:

SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);

  • Andrew

Use “SDL_MapRGB()”, I believe.

http://sdldoc.csn.ul.ie/sdlmaprgb.php

e.g.:

SDL_SetColorKey(surf, flag,
SDL_MapRGB(surf->format, 0, 255, 0));

(GOing off the top of my head :slight_smile: )

-bill!On Wed, Jun 25, 2003 at 09:51:03PM -0400, Andrew wrote:

I’m new at SDL and writing my first program but I can’t figure out how to
set the color key. I have a bmp loaded on my surface “image” and i want the
colorkey to be RGB 0, 255, 0 (green) but I don’t understand what the Uint32
flag is or what to put there referring to:

SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);