3.0 KiB
3.0 KiB
Porting a Java screen or subsystem to the Rust client (ADR 0069)
The Rust build (Horizon, rust/) runs Incari's own client, incari_core
(rust/mods/incari/core/, no game types), with its game side in rust/mods/incari/glue.rs. The
Java client is the spec: same layout, text, behaviour and files. Read first:
docs/adr/0069-incari-client-on-horizon.md,rust/README.md,rust/AGENTS.md.incari_core:src/screen.rs(Screen,Cx,Go, theHosttrait the game side implements),src/client.rs(the screen stack,Client::frame/input/hud_element),src/ui.rs(buttons, menu buttons, entries, switch, slider, text field, scrolling, tooltips),src/paint.rs(Painter: round boxes, icons, text that fits/wraps, shapes, images on the canvas),src/panels.rs,src/screens/(ported screens:list.rsis ListScreen,module_settings.rs,hud_editor.rs,incari_settings.rs,title.rs,grid.rs),src/framework/(modules, settings, profiles),src/modules.rs(every module, Java ids).- The Java source of what you port (paths in your task), its ADR, and the matching
run/smoke-*/incari-smoke/screenshots/*.pngif there is one.
Rules
- Only new files, plus one-line registrations: you may create files under
rust/mods/incari/core/src/(new modules,screens/<name>.rs) and new mod foldersrust/mods/<name>/, and add theirpub modlines tocore/src/lib.rs,core/src/screens/mod.rsandrust/lib.rs. Other agents are doing the same right now, so re-read a file just before editing it and keep edits to those single lines. - Don't edit
client.rs,screen.rs,glue.rs,modules.rs, other screens, other mods, or the Horizon fork (/home/bedrock/Documents/horizon-web-development). When you need something there (aHostmethod, a glue helper, a fork hook point, a button wired to your screen, a new setting), write it down precisely in your report: the signature, what it does, and the exact code to add, so it can be applied as is. Write your screens against those planned APIs (usetodo!()-free code: e.g. take the data as constructor arguments or a trait you define in your own module, so your code compiles now). - No game types in
incari_core; nostd::fs,std::time,std::threadthere either (the browser has none): files and time come throughHost/your own trait. - Hot paths don't allocate; thread-locals, never locks, on the window's thread.
- Tests: pure logic gets unit tests (codecs, layout maths, state machines). From
/home/bedrock/Documents/incari-client/rust:cargo test --workspaceandcargo clippy --workspace --all-targets -- -D warningsmust pass. Errors in files that aren't yours: ignore and mention. Don't run./incari buildor anything inwork/. Don't commit.
Report
What you ported (files), what matches Java and what differs, then the integration list: every change to a file you couldn't edit, as exact code, and every fork hook point you need with its signature and what it must do in Horizon.