Skip to main content

Module module

Module module 

Source
Expand description

Module: a piece from outside the default engine that joins a running Game (ADR-0040).

A module is a library first: the game’s screens call its types. It installs a Module only for what must happen on every frame whatever screen is on top, or be reached by screens it didn’t make. Everything it does is declared in Module::install: the Hooks the game calls, its state on the Ctx (found by type, Ctx::module_state) and its entries on the debug menu (Install::debug_entry). The game lists each module with what it declared (Game::modules).

A module hears of files changed on disk through Module::reloaded. A hook changes the module’s own state and the context’s UI side (a sound), never the game’s data or a stage’s state, which change only through commands or inputs per step. A module takes no actions: one that needs input has a screen, which declares them.

Structs§

Install
What Module::install declares with.
InstalledModule
What a module declared, as Game::modules lists it.

Enums§

Hook
A place in the frame loop where the game calls a module.
ModuleError
Why a module couldn’t be installed.

Traits§

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.