Log inGet started
World

Anvil Crown

Branchmain
Branchesmain
Commit0c3c8404d1

README.md

InterfaceHost

The one line of scene-side wiring that turns "the interface exists" into "the screens are on the glass".

entity.spawn("InterfaceHost").component.add("game.interface.InterfaceHost")

A slice of ANVIL CROWN plugs in by calling A.register from the top level of its module, and a module's top level runs on its first require. A component attached to an entity is loaded by the scene itself, so this component requires game.interface.deck, mounts its screens, and keeps them mounted.

It does three things:

  • Mounts on awake, and re-mounts whenever Deck.isMounted() goes false — which is what a hot reload of the deck looks like from here.
  • Forwards onCallback. A screen belongs to whatever registered it, and only its owner is handed the clicks. Registering from this component and forwarding from here is what makes the title's start button, the pause menu and the end cards respond.
  • Ticks in edit mode too, through editorUpdate, because registered systems only run in play — so the world authors with its interface on.

Put it on any entity in the scene. It carries no fields and no per-entity state; one is enough.