feat(engine): #90 atlas-aware Sprite component, #91 become from listeners, 0.3.x ergonomics batch
All checks were successful
bootstrap / cfree-fixpoint (push) Successful in 32s
ci / build-and-test (push) Successful in 2m49s
commit-lint / conventional-commits (push) Successful in 5s
docs / build-and-deploy (push) Successful in 30s

Closes the two open issues and lands the pending unreleased batch:

- #90: `Sprite { atlas: 1 }` routes esys_sprite through atlas_draw_ex
  (scale/flip/tint), so cell / cell_span / strip ids of any size draw
  through the engine sprite-render system. examples/library/sprite_atlas
  is the pixel-readback regression.
- #91: `become` from an @On(Event) listener / global handler / plain
  function no longer segfaults the compiler; it emits @L_scene_leave()
  (a dispatch on the live scene id) so the leaving scene's on-exit runs.
  UI_* handles are readable from any code (widget table built on first
  use). examples/library/scene_menus covers it.
- fix: a windowed `ludicc -o` build that reaches the audio runtime only
  through the atlas/Assets preload import now links audio.ll +
  AVFoundation (the audio backend link was gated on a game-level
  Audio.* call, so any windowed game declaring Sprite failed to link).
- the hand-written "Unreleased" CHANGELOG section is converted to
  changesets under changes/ so `x release` generates it.
- plus the batch: engine-driven retained UI + UiClicked event, Overlay
  phase, TileSkin tilemap-render system, Key.* constants, Font/Ui/File
  namespaces, Sprite.strip, prefabs, managers, countdown fields,
  enum-typed machines, layer @Queries, ludic.prefs / ludic.dungeon
  packages, Ai.seek pathing, Solids.solid2, cursor confine (mode 3)
  fix, shooter centre-aim fix, reserved-word function diagnostic.

Verified: x test (124/124), x test-tools, check-impl, check-vocabulary,
check-docs, docs-gen + docs-check, bootstrap-cfree (seed is a fixpoint).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-04 01:36:08 +03:00
parent e9c2c51bc3
commit ad548840c7
139 changed files with 58981 additions and 43671 deletions

View file

@ -0,0 +1,7 @@
---
id: ui
title: Ui
order: 43
---
The retained-mode menu API over a <code>ui</code> block. <a href="ui-build"><code>Ui.build</code></a> constructs every declared widget tree once (after fonts and skins are loaded); <a href="ui-open"><code>Ui.open</code></a> makes one menu active and <a href="ui-close"><code>Ui.close</code></a> deactivates it; the frame loop ticks navigation on its own, an activation fires the <code>UiClicked</code> event, and <a href="ui-clicked"><code>Ui.clicked</code></a> is the polled form; <a href="ui-set_text"><code>Ui.set_text</code></a> updates a label or button, and <a href="ui-render"><code>Ui.render</code></a> draws the active menu (call it from an <code>Overlay</code> handler so it paints over the world). Every <code>id: Name</code> in a <code>ui</code> block mints a <code>UI_Name</code> handle.

View file

@ -0,0 +1,21 @@
---
id: ui-build
name: Ui.build
category: ui
kind: namespace-method
tokens: Ui.build
sig: Ui.build()
tip: Construct every declared ui block (loads skins, measures fonts).
order: 1
ns: Ui
member: build
---
Builds the widget trees of every <code>ui</code> block. Call it once, after the fonts and images the blocks reference are loaded — a loading scene's last step is the usual place.
```ludic
# doc-check: skip — illustrative
handler Boot phase Start {
Ui.build()
}
```

View file

@ -0,0 +1,21 @@
---
id: ui-clicked
name: Ui.clicked
category: ui
kind: namespace-method
tokens: Ui.clicked
sig: Ui.clicked(id: UI_Name) -> bool
tip: Was this control activated this frame? (polled form of UiClicked)
order: 5
ns: Ui
member: clicked
---
True on the frame a focused control with that id was activated (Enter, Space, or pad A). The event form is <code>@On(UiClicked) handler … { if id == UI_Name { … } }</code>; either can <code>become</code> another scene.
```ludic
# doc-check: skip — illustrative
handler Menu phase Update {
if Ui.clicked(id: UI_Play) { become Play }
}
```

View file

@ -0,0 +1,21 @@
---
id: ui-close
name: Ui.close
category: ui
kind: namespace-method
tokens: Ui.close
sig: Ui.close()
tip: Deactivate the menu: no menu is open.
order: 3
ns: Ui
member: close
---
Closes whatever menu is active, so nothing is drawn by <code>Ui.render</code> and no click can fire. A play scene opens with it so a menu left over from the title never lingers.
```ludic
# doc-check: skip — illustrative
scene Play {
on enter { Ui.close() }
}
```

View file

@ -0,0 +1,21 @@
---
id: ui-open
name: Ui.open
category: ui
kind: namespace-method
tokens: Ui.open
sig: Ui.open(id: UI_Name)
tip: Make one menu active and focus its first button.
order: 2
ns: Ui
member: open
---
Activates the menu whose root has that id and moves keyboard focus to its first focusable control. Only one menu is active at a time; opening another replaces it.
```ludic
# doc-check: skip — illustrative
scene Title {
on enter { Ui.open(id: UI_TitleMenu) }
}
```

View file

@ -0,0 +1,21 @@
---
id: ui-render
name: Ui.render
category: ui
kind: namespace-method
tokens: Ui.render
sig: Ui.render()
tip: Draw the active menu.
order: 7
ns: Ui
member: render
---
Draws the active menu at its laid-out position. Call it from a handler in the <code>Overlay</code> phase so the menu is painted over the engine-drawn world; it draws nothing while no menu is open.
```ludic
# doc-check: skip — illustrative
layer Menu {
handler Draw phase Overlay { Ui.render() }
}
```

View file

@ -0,0 +1,19 @@
---
id: ui-set_text
name: Ui.set_text
category: ui
kind: namespace-method
tokens: Ui.set_text
sig: Ui.set_text(id: UI_Name, text: s)
tip: Replace a label's or button's text.
order: 6
ns: Ui
member: set_text
---
Sets the text of the label or button with that id; the menu re-lays itself out on its next tick. Interpolated strings make run stats one line.
```ludic
# doc-check: skip — illustrative
Ui.set_text(id: UI_Stats, text: `floor {run.floor} kills {run.kills}`)
```

View file

@ -0,0 +1,21 @@
---
id: ui-tick
name: Ui.tick
category: ui
kind: namespace-method
tokens: Ui.tick
sig: Ui.tick(key: k)
tip: Advance navigation by one key (the frame loop does this for you).
order: 4
ns: Ui
member: tick
---
Moves focus and activates controls from one key code. The frame loop calls it every frame with the frame key, so a game normally never calls it; it remains for programs that drive their own loop from <code>entry</code>.
```ludic
# doc-check: skip — illustrative
entry {
Ui.tick(key: Input.key())
}
```