Skip to main content

Module frame

Module frame 

Source
Expand description

The frame (game ADR-0003): the GlyphBuffer console every screen draws into, ConsoleSpec cells big, with its pictures and rectangles (Items, in Layers) and its Backdrop; colors by name (Rgb, Palette); the text form snapshot tests read (snapshot); fitting the console to a window (console), a shot to a backdrop (cinema) and a picture to an area (portrait); pictures a skin paints at run time (painted, ADR-0078); the debug view’s shapes (gizmo, ADR-0085), drawn by the integer pixel rules of shape; and the one-bit renderer (onebit); with the raster feature, the software painter whose picture every backend must match (raster).

The drawing helpers skins share (draw): GlyphBuffer::panel (a box with a title in its border), GlyphBuffer::meter (a bar that shows how full something is), GlyphBuffer::print_centred and GlyphBuffer::print_cut (a line centred in a rectangle, or cut to a width), next to GlyphBuffer::print, GlyphBuffer::fill_rect and GlyphBuffer::draw_box.

The game picks the console’s size when it starts; nothing here knows it.

Re-exports§

pub use color::ColorSet;
pub use color::EngineColor;
pub use color::Palette;
pub use color::Rgb;
pub use console::ConsoleSpec;
pub use gizmo::GizmoItem;
pub use gizmo::GizmoRole;
pub use gizmo::GizmoShape;
pub use gizmo::LabelText;
pub use glyph_buffer::Backdrop;
pub use glyph_buffer::BoxStyle;
pub use glyph_buffer::Cell;
pub use glyph_buffer::GlyphBuffer;
pub use glyph_buffer::Item;
pub use glyph_buffer::Layer;
pub use glyph_buffer::Overlay;
pub use glyph_buffer::Paint;
pub use glyph_buffer::PxRect;
pub use glyph_buffer::Rect;
pub use glyph_buffer::Sprite;
pub use painted::Painted;
pub use painted::PaintedId;
pub use painted::PaintedKind;
pub use painted::PaintedSprite;
pub use painted::PaintedTable;

Modules§

cinema
Framing a shot over a Backdrop (game ADR-0048): where the window has to start in the scene to look at a point at a zoom. Pure arithmetic; the cinematic’s shots (0817) and the debug menu’s “Scene camera” use it.
color
Colors: Rgb values and the Palette of named colors (game ADR-0012).
console
The console’s size, which the game picks (ConsoleSpec), and how it fits the window (game ADR-0012).
draw
Drawing helpers on GlyphBuffer that skins repeat: a panel with a title set into its top border, a meter bar that shows how full something is, a line print_centred in a rectangle and a line print_cut to a width (with cut, the text it prints).
gizmo
The debug view’s shapes as the frame holds them (ADR-0085): a GizmoItem is Item::Gizmo, drawn over everything else, in a colour the debug skin picked from its GizmoRole. Screens never make these: they hand Gizmos in, and paint_gizmos turns them into items. Each item’s pixels come from shape’s integer rules, as runs (GizmoItem::for_each_run), so every renderer draws the same ones.
glyph_buffer
The GlyphBuffer virtual console every screen draws into (game ADR-0003).
onebit
The one-bit renderer (game ADR-0074): draws a GlyphBuffer the size of the Playdate’s screen (50 × 15 cells of 8 × 16 pixels, ConsoleSpec::text) into a 400 × 240 one-bit Frame laid out as the Playdate’s own frame buffer, so its front end copies it to the screen as it is.
painted
Pictures a skin paints at run time (ADR-0078): a Painted picture whose pixels the game makes while it runs (a decoded video frame, a software renderer’s screen, a plasma), kept between frames in the frame’s PaintedTable and placed with a PaintedSprite.
portrait
Drawing a picture in an area of cells (game ADR-0043): one sprite item, the image at the largest whole scale that fits, centred. A game’s portraits are drawn this way.
raster
The raster: a frame painted in software, the reference picture of a GlyphBuffer that every backend must match. shuyi-app’s GPU renderer is held to it (ticket 2018), and compare is the one comparison every backend’s pixels go through. frame-png, the tool contract and a game’s PNG snapshots paint with it; a game may too, at run time (a save’s thumbnail, a photo mode). It takes decoded pictures: decoding a file is the caller’s (shuyi-cli decodes PNG). Its pictures are shuyi_assets::image::Image, what the image formats decode, so a decoded picture is painted as it is.
shape
Shapes in whole console pixels, by one integer rule every renderer follows (ADR-0085 §8): each gives its pixels as runs, and a renderer fills each run as a rectangle one console pixel high. So shuyi-app, the raster and the one-bit renderers draw the same pixels by construction.
snapshot
Text dump of a GlyphBuffer for snapshot tests (game ADR-0007):