app.module
README.md
app
The interface as one object the game talks to: mount it, feed it, listen to it.
It owns the engine screens (one per screen module, each on its own layer), rebuilds a screen only when its data
changed, ages notifications and banners, turns widget callbacks and menu controls into actions, and asks the
input system for prompt glyphs. The screen modules stay pure; this is the only module here that calls `ui.*`.
NOT YET RUN IN THE ENGINE.
local App = require("metropolisUi.modules.app")
App.mount({ text = Copy.get }) -- registers the theme; `text(key, vars)` is the game's copy
App.setHud(view, { prompts = { { control = "interact", text = "Hold to sign", hold = 0.4 } } })
App.notify({ icon = "brush", text = "Clean. The fish-market wall, Old Quay.", tone = "good", seconds = 5 })
App.banner({ name, rule, line, colour }) -- a district's name across the top for four seconds
App.show("pause", data) App.update("pause", data) App.hide("pause") App.isOpen("pause")
App.input("down") -- menu controls: up, down, left, right, confirm, back, tabPrev, tabNext
local off = App.on(function(action, payload) end) -- "pause:resume", "settings:set:music" { value = 0.4 }, ...
App.tick(dt) -- every frame (the component does this), also while paused
App.unmount()
Screens: "hud", "escaped" (drawn in play), "mission", "caught", "map", "shop", "pause", "settings", "title" (menus).
App.menuOpen() says whether any menu is up, so the host knows when to activate its menu input map.
The interface is documented in the header of init.luau; this file repeats it for the asset browser.