Create a tileset from a tileset definition.Usage:
tileset name.t
The definition file can have any name, but .t is the postfix I'll be using. A tileset definition refers to one or more images (loadable by SDL_image) to cut sections from. The resulting tileset contains graphics with a masking colour defined (the colour that doesn't get copied in blits). It does not define WHAT each tile is for (sprites, terrain, icons).
Definition file format
The file is divided into sections. Descriptions follow here.[tileset]: The first section, normally. It can be anywhere in the file, but it must be unique.
Variables in the [tileset] section
Variables are set in the usual way of INI-style files, with "name = definition" at most once per line.
- name
A string; the name to refer to this set by.- filename
This is a string containing the name you want to use for the output tileset. Usually ends in .iff or .tiles or some other vaguely descriptive surname.- size
Size in pixels of each tile in this tileset. A tileset must have all its tiles the same size. Format: Either width followed by a space, then height, or WIDTHxHEIGHT.
For example:
size = 32x32- maskcol
The transparent colour. The format is hexadecimal:
maskcol = 0xnnnnnn
The 0x prefix is optional.- author
You may specify the name of the artist/packager with this variable. Not required, but the artists will thank you for it if they're any good, and hate your guts otherwise.- comment
Another optional variable. Any string can go here.The next type of section can appear multiple times. It specifies files to grab images from. The section name is [source].
Variables in [source] sections
- image
Name of an image file in any format known to SDL_image. Suggested formats: XPM, PNG or TGA. Non-lossy compression is preferred, as JPEG and similar will probably mess up the pixels in transparent colours. Proper transparency support from PNG is planned, though.- count
The number of tiles that the image holds. The program starts in the upper left corner, then moves right until reaching the rightmost edge, then proceeds to the next line of tiles until count tiles have been grabbed. This variable can be left out if there is only one tile in the source image.IFF chunk types
Here is a list of the different chunks that a tileset contains. The FORM type is TILS.
- NAME
A name to use when referring to this tileset.- AUTH
Name of the author.- ANNO
File comment.- Mask
The mask colour (24-bit RGB colour, big-endian).- Size
Two Uint16 integers with width and height of the tiles in the tileset. Big-endian format.- Tile
A zlib-compressed tile in 24-bit RGB mode. The first ulong (big-endian) in the data is the uncompressed size.Note: If image names are not specified by full paths, the program will attempt to load them relative to the definition file. In other words, the working directory is set to wherever the definitions are.