[SDL] Multiple layers of images on one surface?

Olof Bjarnason olof.bjarnason at gmail.com
Sun Aug 7 05:17:08 PDT 2005


0. enable transparency blitting on the 3 mech surfaces, see below
1. create a surface big enough to hold the whole mech, M
2. blit the body surface B on M
3. blit the canon surface C on M
4. blit the missile surface D on M

Explanation of 0:
Make sure to call SDL_SetColorKey on B, C and D with the correct
"transparency" color (the exact format depends on if you are using
index mode or "truecolor" mode for your surfaces). For example, if you
are using 24 bit surfaces and use the color 0xFF00FF (bright pink) as
transparency color you would first of all do

SDL_SetColorKey(B, SDL_SRCCOLORKEY, 0xFF00FF);
SDL_SetColorKey(C, SDL_SRCCOLORKEY, 0xFF00FF);
SDL_SetColorKey(D, SDL_SRCCOLORKEY, 0xFF00FF);

Good luck!

/Olof

On 8/7/05, Jesper Liljegren <jelc04 at student.bth.se> wrote:
> Hello!
> 
> I am using Rotozoom in the SDL_gfx library to rotate my sprites.
> And in my game I have a Mech (Yea ain't mechs the coolest thing on this
> earth? :D),
> the Mech is 3 layers, top is his missile tower, second his canons, and
> last his body.
> 
> I _could_ rotate and blit all three surfaces separatly, but I don't want to.
> So my questions are rather simple,
> 
> Can I send 3 images to one surface and then rotate, and then blit?
> How do I do this?
> 
> Best regards
> Jesper
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>




More information about the SDL mailing list