Hi!
I have created a little bitmap font system, where I am blitting the
faces to the screen. The font is a bitmap with black pixels and
a pure white background (255,255,255). When I am using the
SDL_SetColorKey function like this:
Any ideas, what causes this and how to get it work correctly?
Ooops, all engines back… Just a little logic error I’ve just encountered…
Sorry! Working fine now…
void drawtile(int x, int y, int tile)
{
if (SDL_MUSTLOCK(gTiles))
if (SDL_LockSurface(gTiles) < 0)
return;
int i, j;
for (i = 0; i < 25; i++)
{
int screenofs = x + (y + i) * PITCH;
int tileofs = (i + tile * 25) * (gTiles->pitch / 4);
for (j = 0; j < 50; j++)
{
((unsigned int*)gScreen->pixels)[screenofs] =
((unsigned int*)gTiles->pixels)[tileofs];
screenofs++;
tileofs++;
}
}
if (SDL_MUSTLOCK(gTiles))
SDL_UnlockSurface(gTiles);
}
transparency:
int Transparent(SDL_Surface* Surf_Dest, int R, int G, int B) {
if(Surf_Dest == NULL) {
return 0;
}
Hi im trying to display tiles as transparent, and it just isnt making any
colours transparent at all, here is the code im using:
i’m not sure i can be of much help here but as no-one has anwsered for a while
i’ll try and point you in the right direction…
you need to be absoulutley sure that the image surface you are using
has exactly
the right colour as you are trying to make transparent, and that it has a
suitable pallette / bpp depth to do so.
at a glance i cant see anything that might be wrong with your code…
but i could
be wrong
i have had issues in the past similar to this… these days i just always use
high colour png’s, and just use black, white or full pink as a mask colour.
I would suspect the problem lies with your source images.