Hi guys,
I have some trouble with the transparent colors.
I do the following:
ImageLoad:---------------------
img->data = (SDL_Surface **) malloc(sizeof(SDL_Surface *)*img->num);
where data is a SDL_Surface** inside the img struct.
After that I do:
tmp = SDL_DisplayFormat(tmp);
colorkey = SDL_MapRGB(tmp->format, sdf.rgb.r, sdf.rgb.g, sdf.rgb.b);
SDL_SetColorKey(tmp, SDL_RLEACCEL | SDL_SRCCOLORKEY, colorkey);
for (i = 0; i < img->num; i++)
{
img->data[i] = SDL_CreateRGBSurface(sf, img->rect.w, img->rect.h,
DEPTH, RMASK, GMASK, BMASK, AMASK);
img->data[i] = SDL_DisplayFormat(img->data[i]);
img->rect.x = img->rect.w * i;
SDL_BlitSurface(tmp, &img->rect, img->data[i], NULL);
}
So I come back to my main function and blit the surfaces on the screen.
The Image A is shawn on the background and the color is not trasparent
but it’s black.
Does anyone say me why?