Add a screen
Screens live in crates/orpheus-apps/src/screens/ and run unchanged in the
simulator and on the player. The grammar they must follow is
05 §3; the layout rules are 05 §4.
-
State and trait. Write a struct and implement
orpheus_ui::nav::Screenfor it:enter(opened with anArg),event(keys and service data; returns aNav: stay, push, pop, home),draw(the content area; withDirty::Changeddraw only what changed), and optionallymenu(the Menu sheet),save/restore(when another screen is pushed on top). -
Register it. Add a variant to
AppScreenand aScreenIdinscreens/mod.rs, and the arm increate,idandname(the name is what scripts check withexpect-screen:). -
Data. Screens never touch hardware or files. If the screen needs something new, add a method to a service trait in
services.rsand implement it twice: in the simulator (sim/src/) and in the firmware (fw/firmware/src/services.rs). Long work is requested, then delivered as anEvent::Data; never block ineventordraw. -
Strings. Append to
strings.rs(ids are never reused or reordered) and add the translations insim/src/packs.rs. -
Look at it.
cargo run -p orpheus-sim -- --script "ok down*2 ok shot:mine" -
Golden images. Add a case to
sim/tests/golden.rs(each case is a key script that takes oneshot:; most cases run for dark and light and for Latin, Cyrillic and CJK text). Thencargo xtask test golden --bless, open every new and changed PNG insim/golden/, and checktarget/orpheus/golden.html. -
On the player (after the gate):
cargo xtask build,cargo xtask dev stage target/orpheus/firmware.yfw, thencargo xtask dev keys '…'andcargo xtask dev shot out.pngto compare with the golden.
Rules that bite: draw through palette roles, never literal colours; text at least 11 px; a key press changes pixels within 50 ms, so move the highlight first and fill in data when it arrives; the Back key never activates anything.