ludic/packages/ludic.ui/fired.ludic
Orkuncakilkaya a299117858 frame keeps: a model's records filled in place, kept event numbers, list spares, Json.read_file
From the fence's kept frames in 22 minutes of play:

- A component field that is a record or a list of records was `value_put(o, k, view_val_T(x))`,
  a whole new tree every frame (HudPrompt's notifications). view_fill.ludic generates view_set_T /
  view_set_list_T / view_fill_T that fill the object and list under the key in place.
- value_list_fit dropped the items it cut off and value_item made new ones as the list grew back,
  a Value per item per regrowth (value_item / value_set_strs); the cut-off items are now the
  list's spares (Val.spare), and an item of another kind is turned rather than replaced.
- ludic.ui: a scroll box's "scroll" and a slider's "change" fired a fresh Value.float a frame
  (sc_walk, scroll.ludic:36); ui_fire_float takes one from a ring kept with the state (fired.ludic).
  ui_object_fit_into is exported, for a draw that keeps its list.
- Json.read_file(path): read, parsed, and the file's text given back - Json.parse(Fs.read_text())
  kept the whole file on every read (Maroon Lake's settings peeks).

Golden value_list_regrow: a list alternating 6 and 2 items every frame keeps nothing (the toolchain
before this fails it: +128 B new Val from value_item). Game compiles; ludic.i18n/settings/hints/
base tests pass (ludic.ui has none); arena and fence goldens unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 12:22:13 +03:00

16 lines
662 B
Text

# fired.ludic - the number a control reports on each frame it moves (a box scrolled, a slider dragged),
# from a ring of Values kept with the state: a fresh Value.float a frame was kept by nothing. The
# queue runs within the frame, long before NT_NUMS more come round to one
const NT_NUMS: int = 64
function nt_nums_new() -> []Val {
let l = new []Val
for i in 0 .. NT_NUMS { push(l, Value.float(0.0)) }
return l
}
export function ui_fire_float(ui_st: mut UiState, n: UiNode, name: string, x: float) -> void {
let at = ui_st.nt_num_at % NT_NUMS
ui_st.nt_num_at = at + 1
let v = ui_st.nt_nums[at]
Value.be_float(v, x)
ui_fire(ui_st, n, name, v)
}