Discussion: [PSP][Résolu] draw images on images
Afficher un message
Vieux 14/02/2007, 06h13   #1
ninjaglowskulls
 
Messages: n/a
Par défaut draw images on images

I'm using OSL to make a basic 2d game. My character is built by using different peices, ie. one Image for the head, one image for the torso, etc. When I draw to the screen, I want to draw all the smaller images onto I big image. This way, when I change direction, I only have to mirror the big image, instead of mirroring each image, then moving the front and back arms to match the new torso.

Anyway, When I draw the images onto the new one, nothing shows up.
Code:
//the big image
charc = oslCreateImage(53, 83, OSL_IN_VRAM, OSL_PF_8888); 
//.  while loop, etc.
//.
//.
oslStartDrawing();
oslSetDrawBuffer(charc);

//a function to draw each of the pieces
//basically an oslDrawImage(bodyPart) for each peice
mainChar->drawCharacter();
oslSetDrawBuffer(OSL_DEFAULT_BUFFER);
oslDrawImage(charc);
oslEndDrawing();
now, if I load an image from a file (for charc), then clear it with a colour, drawing my smaller images seems to work fine...the only problem is that I now have a red rectangle (red was the colour I used) behing my character. Is there a way to initialize my main image with transparent pixels, so that I can draw my other pictures on top of it?

PS sorry about the long post
  Réponse avec citation