code wiki / (root) / nx_wasm_racing.nx

nx_wasm_racing.nx

buildroot/runtime/nx_wasm_racing.nx

5095 B124 linesdepth 1pulls 1 transitivereach 1 importersview sourcekind librarytopic wasm
docsdependenciesstructsconstsfunctions

about

nx_wasm_racing.nx -- BROWSER-PLAYABLE sovereign Racing: BASE-RELATIVE integer core, runs native (-> PNG) AND in the browser (base = 0 = our sovereign WASM linear memory). NO float, NO JS logic, NO canvas drawing. A top-down endless dodge racer: hold left/right to steer the car between descending traffic; survive to grow the distance score; a collision ends the run (shoot/space restarts). init()/tick(input)/render()/score()/ ww()/hh()/fb_off() = the wasm interface (auto-exported). license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_nishi_font_core.nx nx_wasm_racing.nx nx_wasm_racing_gate.nx

imports: nx_nishi_font_core.nx

imported by: nx_wasm_racing_gate.nx

structs

none

consts

7const O_MAGIC_7919: i64 = 7919
8const W: i64 = 120
9const H: i64 = 180
10const NO: i64 = 5
11const SY: i64 = 156 // player row
12const SPEED: i64 = 2
13const O_FB: i64 = 0 // framebuffer W*H i64 at offset 0
14const O_OX: i64 = 172800 // opponent x[16] (W*H*8)
15const O_OY: i64 = 172928 // opponent y[16]
16const O_ST: i64 = 173056 // scalars[16]: 0=px 1=distance 2=gameover 3=tick
17const O_MSK: i64 = 173184 // HUD glyph scratch
18const O_STR: i64 = 181376 // HUD string scratch

functions

20func rgb(r: i64, g: i64, b: i64) -> i64 { return (r & 255) | ((g & 255) << 8) | ((b & 255) << 16) }
called by 1: render_impl
22func fillr(base: i64, x0: i64, y0: i64, x1: i64, y1: i64, c: i64) -> i64
called by 2: carrender_impl
35func respawn(base: i64, i: i64) -> i64
called by 1: tick_impl
44func init_impl(base: i64) -> i64
called by 3: tick_implinitmain
54func tick_impl(base: i64, input: i64) -> i64
called by 2: tickmain calls 2: init_implrespawn
75func car(base: i64, cx: i64, cy: i64, body: i64, top: i64) -> i64
called by 1: render_impl calls 1: fillr
82func render_impl(base: i64) -> i64
118func init() -> i64 { return init_impl(0) }
calls 1: init_impl
119func tick(input: i64) -> i64 { return tick_impl(0, input) }
calls 1: tick_impl
120func render() -> i64 { return render_impl(0) }
calls 1: render_impl
121func score() -> i64 { let st: *i64 = (0 + O_ST) as *i64; return st[1] }
122func fb_off() -> i64 { return O_FB }
123func ww() -> i64 { return W }
124func hh() -> i64 { return H }