[SDL] colorkey in SDL_Texture
micah.brening at gmail.com
Mon Dec 20 14:27:11 PST 2010
You might need to post some code. According to the example code, it should be as follows:
temp = SDL_LoadBMP(file);
SDL_SetColorKey(temp, SDL_TRUE, key);
sprite = SDL_CreateTextureFromSurface(0, temp);
One thing I noticed is that with SDL_SetColorKey, if the second argument is 0 it disables the ColorKey.
The CreateTextureFromSurface should take the colorkey data and set it to an Alpha channel set to 0.
I hope that helps!
If not, try posting some code.
Also, look at the LoadSprite function in the testspriteminimal.c in the test folder of the SDL Mercurial.
> I am porting a project to SDL 1.3 from SDL 1.2
> I need to use a colorkey for my sprites and when i do
> SDL_CreateTextureFromSurface(surface) i loose the colorkey info in the
> SDL_Surface and all the pixels are rendered.
> How can i use a SDL_Texture with colorkey?
> SDL mailing list
> SDL at lists.libsdl.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SDL