Hey guys I can't figure out how to get the sdl colorkey to work, I've tried to find a tutorial on it, but nothing seemed to make sense.
if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
{
printf( "Unable to init SDL: %s\n", SDL_GetError() );
return 1;
}
// make sure SDL cleans up before exit
atexit(SDL_Quit);
SDL_Surface* screen = SDL_SetVideoMode(640, 480, 16,
SDL_HWSURFACE|SDL_DOUBLEBUF);
if ( !screen )
{
printf("Unable to set 640x480 video: %s\n", SDL_GetError());
return 1;
}
SDL_WM_SetCaption( "Battle Pong!", NULL );
// load an image
SDL_Surface* bmp = SDL_LoadBMP("pong.bmp");
if(SDL_SetColorKey(bmp, SDL_SRCCOLORKEY | SDL_RLEACCEL, SDL_MapRGB(bmp->format, 0, 0 ,0)) == -1)
fprintf(stderr, "Warning: colorkey will not be used, reason: %s\n", SDL_GetError());
}
Gives me an error at the maprrgb function, it just says error at this point.
What am I doing wrong?
Thanks,
Joe