fix(ui): 0.R4 - an action a UI button dispatches is reduced before the frame is presented

ludic.ui runs a frame's presses after drawing it, and what they dispatched waited for the end of the
phase - after the host had presented - so a button's change showed a frame late. Decided: drain, not a
phase per action. ui_show and ui_press drain the queue once the presses have run, so the code after
them and the frame presented next see the change; a host that runs presses some other way calls
drain_actions() before it presents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-26 07:08:26 +03:00
parent d46f0adb5e
commit 259b4d9b35
7 changed files with 46 additions and 3 deletions

View file

@ -371,8 +371,10 @@ program Pack {
dispatching needs no state parameter.
- **When the queue is drained:** at the end of every phase of the frame loop (so what the `Input`
phase dispatches is reduced before `Update`); after every phase of the ludic.base system runner
(`core_tick_all`); and wherever the program calls `drain_actions()` (an `entry` program, a test,
a loop of its own). Draining runs the actions in the order they were dispatched, and each action's
(`core_tick_all`); when ludic.ui has run a frame's presses (`ui_show`, `ui_press`), so a button's
action is reduced before the host presents the frame, not a frame later; and wherever the program
calls `drain_actions()` (an `entry` program, a test, a loop of its own - and a host that runs UI
presses some other way calls it before it presents). Draining runs the actions in the order they were dispatched, and each action's
reducers in the order of their states' names - never the order of imports - so the same actions
make the same changes on every machine and in a replay.
- **An action a reducer dispatches** is queued behind the rest and reduced in the same drain, never