On 12/8/06, Luke Crook <[EMAIL PROTECTED]> wrote:
>
> Anthony, do you have to do your rotations in real-time or is it possible to 
> pre-
> process and cache the rotations for each image?
>

I'm actually doing the rotations once and then caching them.  My game
is a jigsaw puzzle.  I take an image and cut it up into square pieces
and then place them on the screen in random locations and rotations.
Rotations are 0, 90, 180 and 270 degrees.   My first strategy was to
precalculate all rotations on startup.  For a 100 piece puzzle, that's
100x3=300 rotations that get performed.  I optimized this later by
making the rotations lazy.  I only create the rotation when it is
needed in the code, either by the initial displaying or when the user
rotates a piece.  This speeds up startup but makes it a bit sluggish
for the user when rotating a piece that does not yet have its cached
rotation.

Another thought I had was to save the rotated images to files once
they are created, thus speeding up future runs of the game.  I haven't
looked that hard yet for a SAVE-IMAGE function.

So what I have now is not that bad.  The fast pixel access functions
you added helped a lot.

> FYI: I am busy updating the lispbulder-sdl API to take advantage of the new
> finalize methods in the CFFI. So you will be able to create an SDL_Surface and
> have the garbage collector take care of freeing the foreign surface when the
> reference goes out of scope.
>

Very nice, I'm looking forward to this.  Right now I think I'm leaking
surfaces all over the place ;-)  One of these days I'm gonna dig into
CFFI and figure out how it works.

Thanks,

Anthony
_______________________________________________
application-builder mailing list
application-builder@lispniks.com
http://www.lispniks.com/mailman/listinfo/application-builder

Reply via email to