[SDL] Fast IMG Load
trick at icculus.org
Fri Jan 14 17:26:51 PST 2005
Benjamin Deutsch wrote:
> Yes! Exactly what I what I was thinking of. Plenty of nice options, too.
> Now nothing can stop me from filling a CD with only the program binary
Glad I could be of help =)
> Just two thoughts:
> - Why not link it from your page? I checked, and you link to other
> "Stuff", but not to this. Shame, really.
Well, mainly it's because I just uploaded it a few seconds before I sent
the mail. I don't have much time to update the site at the moment, but
I'll make a page for it eventually (I'll probably find some time for it
sometime next week).
> - The usage of -d and -p should be documented a bit better. A single
> paragraph with an example would suffice. I'd offer to write it for you,
> but I'd just get it wrong !-)
-p just adds standard include file protection, so that you can include
the file several times from the same source file without getting
redefinition errors. Same thing you do in headers to stop them being
included more than once.
-d adds a declaration/definition selector, so that you can use the data
file both as a header (declaration) and as a "source" file (definition).
You'll want this if you want access to the data from several different
source files and/or headers -- otherwise each source file that included
the data would get its own copy of it, and waste space. To use this, you
basically just include the data normally in all your source files. In
one (and only one) of the source files, the one you want the data to
actually be defined in, you #define DEFINE_BIN_INCLUDES before including
the data file. (The output of -d could use some tweaking, and maybe
DEFINE_BIN_INCLUDES should be renamed, but it does work as it should as is).
Note that although bin2c currently accepts both the -d and -s switches
simultaneously, that combination doesn't actually make sense (there's no
such thing as static external data).
More information about the SDL