Problems with Bitmap Transparency

Hi,

I’m writing a Sidescroller with SDL and I have the following problem:
When I try to run my game in window mode, I can set the transparency
with

SDL_SetColorKey(screen, SDL_SRCCOLORKEY, SDL_MapRGB(screen->format,
255, 255, 255));

So the bitmap tiles in my game have white as the transparent color
and it works fine.
The problem is, that in window mode, the screen cannot be cleared
with:

g_Black = SDL_MapRGB(screen->format, 0, 0, 0);
SDL_FillRect(screen, 0, g_Black);

I don’t understand why. When I move the tiles around the screen they
left a trace behind them.

But I want to write my game for fullscreen mode, and in fullscreen
mode, the transparency do not work! The tiles are displayed with
white pixels around them.

Can somebody help me out with this?

thanks–
Ioan-Tudor Parvulescu
www.itpsoft.de

Ioan-Tudor Parvulescu wrote:

Hi,

I’m writing a Sidescroller with SDL and I have the following problem:
When I try to run my game in window mode, I can set the transparency
with

SDL_SetColorKey(screen, SDL_SRCCOLORKEY, SDL_MapRGB(screen->format,
255, 255, 255));

You are aware that it is source colour keying and not destination colour
keying, right? In other words, you should set the colour key on your
tile surfaces (which are the source of the blit), not on the screen
surface (which is the destination). Of course, I am just guessing this
is what you’re doing wrong from your variable names, so sorry if I’m
wrong.–
Kylotan

Am 11 Aug 2002 um 19:13 hat Kylotan geschrieben:

You are aware that it is source colour keying and not destination colour
keying, right? In other words, you should set the colour key on your
tile surfaces (which are the source of the blit), not on the screen
surface (which is the destination). Of course, I am just guessing this
is what you’re doing wrong from your variable names, so sorry if I’m
wrong.

Thank you! Now it works!

But why is there a difference between fullscreen and window mode?–
Ioan-Tudor Parvulescu
www.itpsoft.de