Get FrameCount?

BlitzPlus Forums/BlitzPlus Programming/Get FrameCount?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

@WillKoh,
there's no way to know how many frames are there in a loaded image, unless you keep track of it manually, as Andy_A has spotted.

You could even use a type structure (or an array, if you will load always a fixed number of images), and keep track of image informations in the structure itself.

So, for example, you can use a type like:
type t_info
field img ;will contain the image pointer
field frames ;the info you will use later
end type
Global info_img.t_info ;the type pointer



;when you load an animated image, you can create a new type instance, and store the related info in the fields:
global myimage = loadanimimage("myimg.jpg",64,64,0,10)
create_info(myimage,10)

;=================================
function create_info(img,frames)
;=================================
info.t_info = new t_info
info\img = img ;the pointer to the image
info\frames = frames
end function


;later, you could use this method to retrieve the frames of a loaded image:

frames = info_frames(myimage)

;=================================
function info_frames(img)
;=================================
for info.t_info = each t_info
if info\img = img then
return info\frames
endif
next
return 0
end function


Hope this has sense for you,
Sergio.