Log inGet started
World

Deep Field

Branchmain
Branchesmain
Commit97b82cdc4f

README.md

ui/shell — the authored screens

Slice presentation. Five screens, one owner each, all laid out for the 1080x1440 portrait frame: the title, the field card, the HUD, the held line and the two end cards.

Screen idModuleWhat it is
df-titledf_screen_titleThe illustration, the name, and the two things you can do
df-howtodf_screen_howtoThe field card that teaches the lamp trade-off in one read
df-huddf_screen_hudThe instruments: depth gauge, lamp dial, attention, the sighting
df-pausedf_screen_pauseThe held line, and the dive so far
df-enddf_screen_endThe lamp is out, or the specimen is named

How it runs

ui.shell.df_boot is the boot module the scene entrypoint calls. It starts ui.shell.df_shell — the state machine that owns which screen is on the glass — and spawns one entity, df_shell_ui, carrying DfShell.component. The component exists only because a UI callback is delivered to onCallback on a component or a scene entrypoint and nowhere else; it forwards the tick and the callback into the module and holds no state of its own.

df_shell_style is the shared look (palette, faces, rule, keycap, paper card, glass pane, action, stat row, motion) and df_shell_art is the drawn work.

What this slice listens for and what it asks for

It follows these events, all of them core-loop's:

  • phase — title shows the title, dive / journal show the HUD, opening / resolution clear the glass for the staging slice's captions, end shows the end card.
  • dive:end { reason } — shows the end card. reason = "apex" resolves the game (the specimen is named); anything else ends the dive.
  • stratum:unlocked — rebuilds the gauge so the new band lights.

It emits three requests. They are requests, not facts: this slice does not own the phase, so it asks and core-loop decides.

  • ui:begin {} — the player pressed Begin the dive.
  • ui:pause { paused } — the player held or released the line.
  • ui:quit { reason } — the player chose to haul in.

ui:begin has a fallback. If nothing has moved Core.state.phase off "title" 0.7 s after the request, the shell moves it itself, so the title screen's only button always does something whether or not core-loop is in the world yet. When core-loop handles ui:begin, the fallback never fires.

Reaching the screens by playing

Everything is reachable from the keyboard and the mouse; no execute call is needed to show a screen.

FromActionTo
titleclick Begin the dive, or SPACE / ENTERHUD
titleclick How to read the water, or Hfield card
field cardclick Lower the lure, or SPACEHUD
field cardclick Back, or ESCtitle (or the held line)
HUDESCheld line
held lineclick Resume, or ESC / SPACEHUD
held lineclick Field procedurefield card
held lineclick Haul in and end the diveend card
end cardclick the primary button, or SPACE / ESCtitle

W S Q E belong to the lure and J to the journal; the shell never takes them.

Two things that shape every screen here

An svg widget draws in an element capture but not on the glass. Every drawing in this slice is therefore either an image of an imported .svg asset (art/*.svg, registered as textures — df_shell_art.REF names them) or drawn in CSS. The lamp dial is a conic gradient plus a rotated bar, the lure bead on the gauge is a glowing disc, and the book's mark is a rotated square (S.lozenge). df_shell_art.regenerate() rewrites the .svg assets from the generators in that module, so the art stays authored in code.

Motion is off unless the simulation is running. Edit mode pauses time, so an entrance animation holds its first keyframe forever — and that keyframe is opacity: 0, which makes the whole screen invisible. Every animation comes from S.riseIn / S.fadeIn / S.breathe, and S.setMotion(false) turns all three into nil in one call. The shell drives it from whether it is ticking live, and rebuilds the screens that carry entrances when it changes.

Layout notes worth keeping

  • A wrapping label needs its width on the container, and that container must not centre-align it: a centred parent makes the label hug its content and collapse to one glyph per line. Centre the text with textAlign.
  • An empty flex child grows to absorb a column's leftover space however tall it is declared, so vertical rhythm is marginTop, never a spacer box.
  • The HUD is composed of absolutely-positioned bands over a root that carries only a size and position — no background, no overflow. That is the one configuration whose layout has held steady here.