Hi, I just got done with a small packer that I use for my sprites.. it's very simple, and it doesnt have any compression at the moment, the way it works is that I put every sprite in a file called say "sprite001.bmp", then I tell it how many sprites Im gonna have, so it'll iterate from file "sprite001.bmp" to "spriteNNN.bmp", this is what I did:
first I had a Header for the Sprite File something that looks like this:
typedef struct
{
int TotalSprites; // number of sprites in this file
int Width;
int Height;
} SpriteHeader;
Then I opened "sprite001.bmp", I took the Width and Height from the Bitmap Info Header and put them into that structure (the TotalSprites was passed as a parameter on the function) then I wrote the Header into the custom file.
and then I loaded the actual bitmap into a temporary buffer (sprite001.bmp), then I just wrote that into the custom file.
Then I made a loop that would iterate from file sprite001.bmp to spriteNNN.bmp
Notes:
- The file header is only written once, all the images are written to the file continously.
- With this method all the sprites (or textures) have to be the same width and height)
Another nice thing that came thru this method is that even tho it has no compression, the packed file ended up being 33% smaller than all the single .bmp files.
If you need more info or something eMail me at visual@guate.net and I'll gladly help you out.
Good Luck!
------------------
Luis Sempe
visuallr@netscape.net
http://www.geocities.com/SiliconValley/6276