Tools : Encoder

Overview | Sprite Editor | Encoder | Kyra XML

NOTE: The Encoder will read relative paths at input, but will output in the current directory.

The encoder is a utility that takes the image files and xml files, that you've created or that were created by the Sprite Editor, and writes dat files and header files. (Go to the Kyra XML link for a description of the XML file format.)

The encoder can take as input any number of .xml files. The .xml files each reference an image file, so image files are not specified on the command line. As each file is processed, a part of it will be displayed on the screen.

Sprites can span multiple XML or image files. For example, in foo1.xml, you could define the "TANK" sprite, and load several frames of its "ROLLING" action. Later, in foo2.xml, you could specify the "SHOOTING" acion of the "TANK" sprite. All the actions and frames will be compositied together by the encoder. This works whether using XML created by the Sprite Editor, or with the <Direct> tag in direct encoding.

The syntax is:

krencode [options] outputfile inputfile inputfile ...

The option -pPREFIX will append a prefix before each name. To continue the BEM example, the command line would be:

krencode -pBEM_ bemexample.dat bem.xml

The option -w will cause the program to wait for the spacebar to be pressed before moving on to the next image.

The option -r will specifies a text file that the xml filenames will be read from. This is useful if you are using many xml files. The '#' character will be interpreted as a comment line.

Note that this is not a complete example, so don't write a bem.dat file. The actual command line for the BEM example is:

krencode -pBEM_ bem.dat bem.xml bem2.xml

Whichever you use, a .dat file and a .h file will be created. This .dat file is loaded by the Vault (see the Engine section) at run time to access the SpriteResources and TileResources. The header is a C++ header that can be included by your source in order to access the SpriteResources by their Id. Any Resource can be accessed by its name or by an id value.