Skip to main content

Module prelude

Module prelude 

Source
Expand description

What a game on the short path names (ADR-0036), and the start types a game names when it leaves it. Anything else is named by its module’s path.

Re-exports§

pub use crate::AppInfo;
pub use crate::BasicGame;
pub use crate::Card;
pub use crate::Look;
pub use crate::Setup;
pub use crate::Start;

Structs§

BasicData
A game’s data on the short path: what the engine reads from the standard files, the files themselves and the game’s own part T. Its actions are A (most simply UiAction), its colours the engine’s.
Bundle
The layers a game reads its files from.
Cell
One console cell: a glyph with foreground and background colours.
ConsoleSpec
A console’s size: cols × rows cells of cell_w × cell_h logical pixels. The frame (GlyphBuffer) keeps the spec it was made with; the game picks one when it starts (game ADR-0070 §6).
ContentError
One problem found while loading or validating an asset. Build it with ContentError::new and its methods (ADR-0039).
Ctx
Resources shared by every screen: the engine’s, and the game’s in game.
FrameInput
One frame’s input as a screen sees it.
Game
Owns the screens, input state, shared context and the console buffer.
GameHooks
Where the game has a say in the frame loop. Default has none.
GlyphBuffer
A grid of Cells, row-major.
Install
What Module::install declares with.
Layer
One layer of the bundle.
Rect
A rectangle of cells. A non-positive w or h means empty.
Rgb
A 24-bit RGB colour. Ordered red, then green, then blue: an order for maps, not a look.
ScreenResult
A value a screen pops with (Transition::PopWith) for the screen below, which reads it back as its type in Screen::uncovered. Any 'static type will do; the two screens agree on which.

Enums§

BoxStyle
Border style for GlyphBuffer::draw_box (game ADR-0012: single for panels, double for focus/modal).
EngineColor
The colors the engine’s own widgets ask for. A game’s ColorSet says which of its palette’s names each one is (engine_name).
Hook
A place in the frame loop where the game calls a module.
Transition
What a screen asks the stack to do after an update.
UiAction
What the generic widgets (a menu), the Key bindings screen and the debug hook react to. A game maps some of its actions onto these with ActionSet::ui; the rest are its own business.

Traits§

ActionSet
Everything a player can ask for in one game: the game’s action enum. The keymap file, the keymap, held keys and repeat, the player’s saved bindings and help text are all built on it, never on one game’s actions.
GameData
The game’s part of the Ctx, and what the engine reads from the game’s data through it: its actions, colors, text, keys, audio manifest and palettes, and the hooks where the game has a say.
Module
A piece that joins a running game: the game installs it with Game::with_module, and calls only the hooks its install declares, in install order.
Screen
One screen of a game: a title, a map, a menu overlay, …

Functions§

print_centred
Prints text centred on row y. A text wider than buf starts at column 0, cut to the buffer’s width.