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?
Hello!
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.
T-1000 wrote:> 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
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org