[SDL] Want to see something scary?

Sam Lantinga slouken at devolution.com
Tue Apr 11 06:50:02 PDT 2000


Hi,

I managed to load in a picture with the SDL_picture thingy. i notice
that moving the picture around works quite slow, though. I am not sure
if I did that correct, so let me describe it basically, correct me if
this is ridiculous:

while (image_moves) {
- save the background
- copy the image on the screen
- display the new screen
- copy the background back
- move the image
}

Off course I noticed that this went rather slow, as my image was quite
big and for a big part (alpha-) transparent (PNG).

I read that it could help, especially for lower-res displays to convert
the image. I did this with SDL_DisplayFormat. Things speeded up
amazingly, but that was because SDL_Displayformat removed alpha from my
picture. Reading the docs on that one told me that I "should set the
colorkey and alpha value before calling this function". I tried to do
that with SDL_SetAlpha but with no results.

I have no experience with colormaps, etc. so it is not directly clear to
me what I am expected to do to solve this. (Off course I could stop
converting the image, but that would be a foolish thing to do if I want
my game to be usable on different display formats.) Any suggestions?

Thanks,

Stefan



More information about the SDL mailing list