Skip to main content

Module snapshot

Module snapshot 

Source
Expand description

Text dump of a GlyphBuffer for snapshot tests (game ADR-0007):

<glyph rows, a char a cell, trailing spaces kept>
--- colours ---
<rows of single-char keys, one per cell>
--- legend ---
a = fg:text bg:panel
b = fg:highlight bg:#1c3a79
--- overlays ---
over  18,46 11x2  hp_mid
over  sprite 8,8 80x80  images/test_card.png 0,0 16x16

Each distinct (fg, bg) pair gets a key in first-seen order (row-major): a-z, A-Z, 0-9, then further Unicode letters should a screen ever use more than 62 pairs. Colours print as their palette name when one matches exactly, else as #rrggbb. Lines end in \n on every OS.

A wide character’s second cell (a continuation, Cell::is_continuation) prints as nothing in the glyph rows, so a row with wide text reads as it is drawn, the wide character taking the room of two: such a row has fewer chars than the buffer is wide. The colour rows still have a key a cell.

The overlays section lists the buffer’s items in drawing order, in console pixels; it is left out when there are none. A rectangle (game ADR-0018) is layer x,y wxh colour. A sprite (game ADR-0038) is layer sprite x,y wxh image x,y wxh: where it is drawn (dest), the image’s path in the asset bundle, and the part of the image shown (src). After that come, only when they aren’t the default, flip, opacity=N (below 255), bright=N (below 255: darkened, game ADR-0075), solid=colour, dimmed or shade=grey:red,green,blue (how its pixels are coloured, game ADR-0049; a shade is a light’s numbers in thousandths, game ADR-0058) and clip=x,y wxh (not all of dest is drawn). A painted picture (ADR-0078) is layer painted x,y wxh id WxH kind rN hash: where it is drawn (dest), the picture’s id, its size, rgba, indexed or one-bit, its revision and the FNV hash of its pixels, palette and mask (sixteen hex digits), so a test sees it changed without reading it; id missing when the frame’s table lacks it. After that come src=x,y wxh (not the whole picture), bright=N and clip=x,y wxh, only when they aren’t the default.

A gizmo of the debug view (ADR-0085) is over gizmo channel role and its shape: rect x,y wxh, line x,y x,y (from, to), cross x,y n (centre, arm), circle x,y r (centre, radius) or label x,y "text" (the pixel it was placed at, and its text). After that comes clip=x,y wxh when not all of the shape is drawn (never for a label, whose glyphs are in the cells):

over  gizmo grid bounds line 0,0 0,159
over  gizmo grid note rect 32,48 16x16
over  gizmo grid note label 32,48 "0"

A see-through cell (game ADR-0048) gets a key of its own, whose legend line says bg:see-through: in the colour rows a hole can’t be taken for a blank cell. When the buffer has a backdrop, a line --- backdrop: clip x,y wxh origin x,y zoom N --- follows (the window in console cells, the scene pixel at its top-left to a tenth of a pixel, the zoom) and then the scene’s own snapshot, in this same format.