@external-css=allegro.css @document_title=dat2c

The dat2c utility


@!text @heading Contents @shortcontents @text @heading Introduction 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. @heading Commandline Options Each option may appear only once. To specify which datafile to convert, give the filename without a preceding option. --cfile, -o Arguments: filename 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. --hfile, -h Arguments: filename Gives the name of the C header file to output. Won't add a .h extension, even if you don't specify one. --prefix, -p 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 <prefix>_<obj_name> . --crlf, -C Arguments: none Forces the file to be output in CRLF (DOS) format. This is the default on DOS/Windows platforms. --unix, -U Arguments: none Sets the output to be in Unix (LF only) text format. This is the default on non-DOS non-Mac platforms. --mac, -M Arguments: none Sets the output to be in Macintosh (CR only) text format. This is the default on Mac platforms. --global, -g Arguments: none 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. --convert-compiled-sprites, -S Arguments: none (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 :-) --datafile-name, -n Arguments: C identifier By default, the datafile is exported as: PREFIX_data or data But with this option, you can change 'data' to be something else. @heading Notes - 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!).