Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » internal files

This thread is locked; no one can reply to it. rss feed Print
internal files
xinco1
Member #8,061
December 2006

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

spellcaster
Member #1,493
September 2001
avatar

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.

--
There are no stupid questions, but there are a lot of inquisitive idiots.

Johan Halmén
Member #1,550
September 2001

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.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

ImLeftFooted
Member #3,935
October 2003
avatar

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/

Go to: