Indexing animation frames.

BlitzMax Forums/BlitzMax Beginners Area/Indexing animation frames.

CGV(Posted 2008) [#1]
Is there any way to index a single frame in an animation strip?

Given this:

Global img:TImage = LoadAnimImage("cells.png", 32, 32, 0, 8)

How would I grab the third cell, for instance, and hand it over to another TImage pointer?

ie: Local img3:TImage = img[2]

Obviously the above doesn't work but it shows what I'm trying to achieve.

The DrawImage() function does exactly this internally so there must be a way.


tonyg(Posted 2008) [#2]
local image3:timage=loadimage(img.pixmaps[n])

where n is the frame counting from 0.


CGV(Posted 2008) [#3]
ok, I never would have figured that one out.

Thanks a lot, tonyg.

EDIT: Just to clarify, LoadImage() used this way grabs the image from memory and doesn't actually reload it from the HD, right?


tonyg(Posted 2008) [#4]
EDIT: Just to clarify, LoadImage() used this way grabs the image from memory and doesn't actually reload it from the HD, right?


Yep.