Expand description
The GlyphBuffer virtual console every screen draws into (game ADR-0003).
Positions are i32 so callers can draw partly (or wholly) off-buffer:
every primitive clips to the buffer and never panics.
Besides cells, a buffer holds Items, placed in console pixels:
Overlays, coloured rectangles for what whole cells can’t draw (HP
bars, the path line; game ADR-0018), Sprites, pictures from image
files (game ADR-0038), pictures a skin painted
(PaintedSprite, ADR-0078) and the debug
view’s GizmoItems (ADR-0085), over everything. Within a layer, items are drawn in the order they were
added. They belong to the cells they were drawn with: replacing cells
(GlyphBuffer::fill_rect, GlyphBuffer::blit) removes the parts of
items over them.
A buffer may also hold one Backdrop (game ADR-0048): a second buffer, the
scene, shown through a window of cells at a pixel offset and a whole
zoom, behind the cells marked Cell::see_through.
Text is drawn left to right, one character to a cell, but a wide one
(a Japanese or Chinese character, as the buffer’s CellWidths say)
takes two: the first holds the character, the second a continuation
(Cell::is_continuation) in the same colours, and a renderer draws
one glyph over both. Replacing either half of a wide character makes
the other a space, so a continuation always follows its first half.
Structs§
- Backdrop
- A scene shown through a window of a
GlyphBuffer’s cells. - Cell
- One console cell: a glyph with foreground and background colours.
- Glyph
Buffer - A grid of
Cells, row-major. - Overlay
- A solid rectangle drawn on top of the cell grid (game ADR-0018).
- Rect
- A rectangle of cells. A non-positive
worhmeans empty. - Sprite
- A picture on top of the cell grid (game ADR-0038): part of an image file,
scaled into a rectangle of console pixels.
appdraws it from a texture with nearest-pixel sampling, so whole-number scales stay sharp.
Enums§
- BoxStyle
- Border style for
GlyphBuffer::draw_box(game ADR-0012: single for panels, double for focus/modal). - Item
- Something drawn on top of the cell grid, in console pixels. More kinds
may come: a
matchon it has a_arm. - Layer
- When an
Itemis drawn relative to the cells’ glyphs. - Paint
- How a
Sprite’s pixels are coloured (game ADR-0049). Whichever it is, a pixel is as see-through as the image has it.
Constants§
- MAX_
ZOOM - The biggest zoom: whole steps 1× to 4× only
(
docs/design/title-screen.md, Intro cinematic).
Type Aliases§
- PxRect
- A rectangle in console pixels (the logical space before scaling: a cell
is its buffer’s
ConsoleSpec::cell_px). Same shape as a cellRect.