Hi !
I'm french so excuse my faults please :)
Surfacetemp is a Software SDL_Surface* (RAM)
Vramtemp is a Hardware SDL_Surface* (VRAM), filled in black (0,0,0)
I've got a SDL_LoadBMP() who loades a bitmap in Surfacetemp.
I want to copy this bitmap in Vramtemp and set it the Color Key (0,255,0)[GREEN]
In the first time, I tried to blit Surfacetemp on Vramtemp, then set the color key of Vramtemp :
SDL_BlitSurface(Surfacetemp,NULL,Vramtemp,&Recttemp);
SDL_SetColorKey(Vramtemp, SDL_SRCCOLORKEY, SDL_MapRGB(Vramtemp->format, 0, 255, 0));
The bitmap is well blitted on Vramtemp, but the colorkey is not transparent in game !
Then I tried to set the colorkey green on Surfacetemp, to blit Surfacetemp on Vramtemp, then to set the colorkey black on Vramtemp :
SDL_SetColorKey(Surfacetemp, SDL_SRCCOLORKEY, SDL_MapRGB(Surfacetemp->format, 0, 255, 0));
SDL_BlitSurface(Surfacetemp,NULL,Vramtemp,&Recttemp);
SDL_SetColorKey(Vramtemp, SDL_SRCCOLORKEY, SDL_MapRGB(Vramtemp->format, 0, 0, 0));
This second method works, but I wonder why the first didn't work...This method doesn't satisfy me much :Is there a way to do it like I wanted to ?
(I hope my english is understandable -___-)
Thank you ! :)