Scriber.Art (Scriber v0.1.2)

Copy Markdown View Source

The game's tile art, drawn in code, and the Cauldron2D.Atlas it is installed into.

Every tile is a 16×16 RGBA raster built from FrenchCurve.Draw primitives; no image is decoded and no asset ships with the game.

Each entry carries three renderings of the same thing, so text and pixel modes cannot drift: the raster, a two-column glyph, and an RGB colour. The glyph is two columns wide because one tile occupies two terminal cells.

Terrain rasters (:rock, :wall, :floor, :door, :console, :gate, :stair) fill their tile opaquely. Everything that stands on terrain — the player, monsters, items — is drawn on a transparent background so Cauldron2D.Surface composites it over whichever floor it is standing on.

The atlas also carries a :dim tint, applied by the renderer to remembered but unlit tiles.

Example

Scriber.Art.install()
#=> :scriber

Summary

Functions

Every art name in the catalogue, in drawing order.

The :dim tint: one pixel darkened and shifted towards blue.

Draw every tile in the catalogue and install the atlas, returning name/0.

The atlas name install/0 registers under and every caller refers to.

Functions

arts()

@spec arts() :: [atom()]

Every art name in the catalogue, in drawing order.

dim(arg)

The :dim tint: one pixel darkened and shifted towards blue.

Scales red by 0.30, green by 0.32 and blue by 0.42, leaving alpha untouched.

install()

@spec install() :: atom()

Draw every tile in the catalogue and install the atlas, returning name/0.

Installation is per-VM and idempotent: a second call finds the atlas already installed and draws nothing. Must be called before any surface using this atlas is rendered.

name()

@spec name() :: atom()

The atlas name install/0 registers under and every caller refers to.