PDA

View Full Version : SDL and transparancy in tiles


Taxxodium
2003.10.07, 04:24 PM
I'm currently trying to write a game but I have come on a little problem.

Some of my tiles have a "green screen" that is used as the transparent color, which is set in SDL's function SetColorKey()

However, when I draw this picture, all I see a small green border around my "non tranparent" graphic.

How can I solve this?

Also, I've noted that SetColorKey only works on BMP files and so if I opened a TIF file for example with the SDL_image library, I would get my green background handled as green.

Thanks in advance

sealfin
2003.10.08, 03:44 AM
I've been able to handle transprent images with SDL_image in almost every format (yes, except .tiff, which just crashes the app - I think that's sightly buggy.)

Quick but dirty way would be to ensure the pixel 0,0 in the image is always the transparent colour - then pass that pixel to SDL_SetColorKey (this negates the need to mess about with SDL_MapRGB.)