Skip to main content

Module glyph_tiles

Module glyph_tiles 

Source
Expand description

glyph-tiles: a tileset made from the font’s glyphs, for a game that wants a sprite skin before it has art (as the game’s test-tileset does): each tile is a square of a palette color with up to a few glyphs stamped on it, centred, in another; a tile with no background is clear but for its glyphs (a piece drawn over the ground). Tiles are laid out in the order shuyi.ron lists them, columns to a row, so tile i is at column i % columns, row i / columns.

The same font, palette and list always give the same pixels: generated from the game’s own data, not art.

Constants§

MAX_GLYPHS
The most glyphs one tile may have.

Functions§

render
Draws the tileset rules describes with the font atlas atlas (its picture atlas_image) and the colors of palette. Fails on a color the palette lacks, a glyph the atlas lacks, or a tile of no glyphs, too many, or too many to fit.
render_files
The tileset of rules, read from the files they name under root.
run
Runs the command: draws the tileset and writes it to rules.out under root; returns what to print.
tile_origin
The pixel of the top-left corner of tile index of rules.