dat2c - Compile datafiles into C code
The utility dat2c can be used in much the same way as dat2s, above, except
that it writes C code rather than assembler. This has the advantage that it
is portable - you can compile it anywhere you can use Allegro.
Each option may appear only once. To specify which datafile to convert,
give the filename without a preceding option.
Gives the name of the C source file to output. Won't add a .c
extension, even if you don't specify one. By default, dat2c will
write to stdout.
Gives the name of the C header file to output. Won't add a .h
extension, even if you don't specify one.
Arguments: prefix (must be a valid macro name)
If you specify a prefix, then this will be used when constructing a
macro name for each object in the datafile. This is the same as the
grabber; if you don't specify a prefix, the macro name is simply
<obj_name>, but if you do, then the macro name becomes
Forces the file to be output in CRLF (DOS) format. This is the
default on DOS/Windows platforms.
Sets the output to be in Unix (LF only) text format. This is the
default on non-DOS non-Mac platforms.
Sets the output to be in Macintosh (CR only) text format. This is
the default on Mac platforms.
Specifies that the objects should be globally visible (default is
for objects to be local to the compilation unit). If they are
globally visible, then you can refer to them in your code.
(See note below for more info on compiled sprites). Tells dat2c to
convert any compiled sprite objects it finds into bitmap objects.
More a convenience feature for lazy people :-)
Arguments: C identifier
By default, the datafile is exported as:
But with this option, you can change 'data' to be something else.
- If your datafile contains truecolor images, be sure to call
fixup_datafile() after you have set the graphics mode. You must
also call fixup_datafile() if your platform does not support
constructors (currently any non GCC-based platform).
- Compiled sprites are *not* supported (but see the commandline option
--convert-compiled-sprites , above). This is because Allegro silently
switches to an RLE_SPRITE implementation on platforms which don't
support compiled sprites, and to get dat2c to implement that behaviour
would be more effort than it is worth (especially since you can just
call get_compiled_sprite() anyway!).