Improved DefData utility - All files supported!
BlitzMax Forums/BlitzMax Programming/Improved DefData utility - All files supported!
| ||
Hey all, Yesterday I posted a utility for embedding bitmap images into ascii listings by converting them to DefData statements. Here is a simple update to support any kind of file.. sounds, music, gfx etc while making use of any possible compression via blitz's zlib library. How it works: A drag-and-drop utility loads the source file into a memory bank, compresses it and converts the compressed data into a bunch DefData statements for you to paste into your source... #circle_tga DefData "circle.tga",4140,919 DefData "789CCD977B688D71........... (etc) A re-build routine turns those DefData statements back into the target file on the end users machine when the program is compiled and ran. ' Point to the image data.. RestoreData circle_tga ' Build the file.. DataToFile() ' Load the image normally.. Local c:TImage = LoadImage( "circle.tga" ) I've tested with wav files, jpg, tga images etc. *** ANOTHER DISCLAIMER *** No one will thank us for clogging up these boards with massive code lisitngs so please, please use with respect. I've posted here for your input before I submit it to the code archives. Cheers Matt MaxGUI drag-and-drop conversion utility... A sample with gfx and sound.. |
| ||
That sounds cool, but why would you want to use DefData for assets instead of IncBin? |
| ||
It's for posting complete games and demos as source-code instead of relying on external hosting for assets. |
| ||
Handy - wouldn't use this (or IncBin) for releasing commercial games, though. When I first released Magicville (using IncBin), it took cracking on for two minutes to launch the game because all of the game assets were included in the EXE and SoftwarePassport didn't like that at all. Bigger file = slower witchcraft happening. Just something to bear in mind! |
| ||
I agree with GFK but I also think that it's great for it was made for. |