I have the simple begginings of an isometric tile engine into which i have loaded a small tiled area with 0,0xFF, 0xFF transparency that works fine.
I have just chucked a sprite on screen with exactly the same transparence... i've even set the colorkey off of the sprite to make sure... but the sprite is still showing its background like so:
These are the exact images being used
This is the Code in main() that loads up the images and sets transparency:
screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
Tiles = load_image("Tiles.bmp");
Sprite = load_image("Sprite.bmp");
Uint32 colorkey = SDL_MapRGB( Sprite->format, 0, 0xFF, 0xFF );
SDL_SetColorKey( Tiles, SDL_RLEACCEL | SDL_SRCCOLORKEY, colorkey );
And this is my load_image function:
SDL_Surface *load_image (std::string filename)
{
SDL_Surface *Image_Loader = NULL;
SDL_Surface *Image = NULL;
//Create a loader for the image
Image_Loader = SDL_LoadBMP(filename.c_str());
if(Image_Loader != NULL)
{
//Transform the image to match the Display Format.
Image = SDL_DisplayFormat(Image_Loader);
//Free up the loader again.
SDL_FreeSurface(Image_Loader);
}
return Image;
SDL_FreeSurface(Image);
}