internal files
xinco1

Does anybody know if its possible in allegro to store files inside the exe, for example images, and how to call them???;D

spellcaster

Yes. You can use datafiles and then use dat2c to create files you can compile into your exe. Please check the section on datafiles in the allegro documentation for more info.

Johan Halmén

Hope you don't intend to save in the exe at runtime, because that would be insane, although possible. Coding in the style of Vafnar Cebtenzzre, an Italian game maker.

Dustin Dettmer

Look in your allegro tools directory for these applications:

  • grabber.exe

  • exedat.exe

Now put them in a handy spot (ie same directory as your game) and perform these steps:

  1. Use grabber to create a datafile (in this example we'll name it 'data.dat') and upload your images in. Be sure to give names in grabber and remember them.

  2. Run a test loading the image(s) to make sure everything went correctly. Heres some example code to do so. I'm going to assume you have an image named "IMAGE01".

  3. Once you work out all the quirks and get your image displayed correctly on the screen, you're going to want to change the parameter from load_datafile to "#" (which means 'load from self'). Your load_datafile line should now look like this:

  4. Find exedat.exe in your allegro tools directory. I'm going to assume your game executable is named omgGame.exe. Now run (in a command prompt) the following command:

  5. Profit!

If you have any hangups don't hesitate to check the manual:
http://www.allegro.cc/manual/api/datafile-routines/

Thread #591756. Printed from Allegro.cc