Page 1 of 1

frame animation??

PostPosted: Feb 18, 2005 @ 7:50am
by impe20

PostPosted: Feb 18, 2005 @ 11:00am
by Structure

PostPosted: Feb 18, 2005 @ 6:18pm
by Kiyote
The .Net wrapper I wrote has some rudimentary support for this. Load a GapiSurface and set the .Frames property. Then when you blit, one of the overloaded Blit methods takes a FrameIndex parameter.

The only catch is that your sprite frames have to be laid out horizontally.

PostPosted: Feb 19, 2005 @ 5:30am
by InexorableTash
Note that storing frames in one large surface can negatively impact performance. Modern processors (like ARM) cache data in blocks - if you read byte 5, bytes 0 ... 255 are probably cached as well.

If you think about this, it means that when you're drawing one frame from a horizontal strip you're probably using only a fraction of each cached block per row of the surface. I.e. if you were using the frame made up of 'x' pixels in this strip:

ooooooooxxxxxxxxoooooooooooooooooooooooooooooooo
ooooooooxxxxxxxxoooooooooooooooooooooooooooooooo
ooooooooxxxxxxxxoooooooooooooooooooooooooooooooo
ooooooooxxxxxxxxoooooooooooooooooooooooooooooooo

... then odds are all of the 'o' pixels will get cached as well. So you might have to hit memory 4 times (once per row) rather than just once if you had a single frame with 'x' in it.

If you stack the frames vertically, on the other hand, you'll will have cache coherency of the data. (I'm kinda sleepy, but I think this holds true even when GapiDraw loads and rotates the images, but someone should confirm.)

You might want to write a routine that slices up your frames into different surfaces on load.

PostPosted: Feb 19, 2005 @ 8:59am
by Guest

PostPosted: Feb 19, 2005 @ 11:41pm
by InexorableTash

PostPosted: Mar 17, 2005 @ 9:26am
by impe20