This is written for development under Windows, but it shouldn't be hard to adapt this to a Linux environment.
An easy way to embed resources into the app is to use a utility often called bin2h to convert the binary files to a c header, and then include that header in your project.
A utility for this can be found here:
exe,
sourceThen, if you don't want to specify each resource individually, and don't want multiple .h files, you can create a bat-file with:
DEL ..\src\images.h
FOR %%X IN (*.tga) DO bin2h %%X
FOR %%X IN (*.h) DO type %%X >> ..\src\images.h
DEL *.h
This piece of code creates individual .h files for each .tga file in the folder, and then creates a combined .h file in the src directory.
The code assumes that your folder structure is like the following:
-
src-
res <-- here you have the bat file and your resources
Edit:
If you're looking for a tga loading function which takes an array generated by bin2h instead of a file, check out the
SameGoo sources in graphics.c.