2
\$\begingroup\$

I'm trying to make a simple 2D animation file format. It'll be very rudimentary: only an XML file containing some parameters (such as frame duration) and metadata, and some images, each representing a frame.

I'd like to have the whole animation (frames and XML document) packed in a single file. How do you suggest I do that? What libraries are there that would allow easy access to the files inside the animation file itself?

The language I'm using is C++ and the platform is Windows, but I'd rather not use a platform dependent library, if possible.

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

I'd suggest packing them into a simple .zip archive; there are several libraries out there (a good one using the minizip function of ZLib is discussed here). That way, you'll have an XML file uncluttered with other embedded information, and then all the graphics resources out in their own files inside the archive. This might also allow for better compression of the binary data (very unsure about this).

\$\endgroup\$
1
  • \$\begingroup\$ Note that ZLib is cross-platform, and that it is well tested. I really think that this is probably the easiest solution in your case. In the XML file, use relative paths, i.e. "/walking/frame1.tga", and then have the loading code handle those in the archive. Shouldn't be more than 10-20 lines at the most for that. You might also want to consider using big sprite sheets for families of animation. \$\endgroup\$
    – ChrisE
    Commented Mar 19, 2011 at 20:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .