code wiki / (root) / nx_wasm_arcade.nx

nx_wasm_arcade.nx

buildroot/runtime/nx_wasm_arcade.nx

5219 B120 linesdepth 1pulls 1 transitivereach 2 importersview sourcekind librarytopic wasm
docsdependenciesstructsconstsfunctions

about

nx_wasm_arcade.nx -- the CORRECTED sovereign browser game: BASE-RELATIVE integer arcade. The SAME code runs native (base = a real mmap -> render a frame to PNG for eyeball verify) AND in the browser (base = 0 = our own sovereign WASM linear memory). NO float, NO JS logic, NO 3rd-party canvas drawing. Game logic (move/collect) + integer rasterizer write a packed-RGB framebuffer at a FIXED linear-mem offset; the blit shim only copies that framebuffer to the screen + forwards keys. nx_wasm.nx auto-exports every func + the linear memory, so init()/tick(dir)/render()/ww()/hh()/fb_off() become the wasm interface. The HUD score is drawn into our OWN framebuffer by the sovereign Nishi font (no JS/canvas draws text). license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_nishi_font_core.nx nx_wasm_arcade.nx nx_arcade_hud_gate.nx nx_wasm_arcade_gate.nx

imports: nx_nishi_font_core.nx

imported by: nx_arcade_hud_gate.nxnx_wasm_arcade_gate.nx

structs

none

consts

9const W: i64 = 240
10const H: i64 = 192
11const CELL: i64 = 24
12const GW: i64 = 10
13const GH: i64 = 8
14const O_FB: i64 = 0 // framebuffer: W*H i64 (packed RGB), at linear-mem offset 0
15const O_GX: i64 = 368640 // W*H*8
16const O_GY: i64 = 368768
17const O_HX: i64 = 368896
18const O_HY: i64 = 369024
19const O_ST: i64 = 369152 // scalars: [0]=px [1]=py [2]=score [3]=ng [4]=nh
20const O_MSK: i64 = 376832 // HUD glyph scratch mask (base-relative; no sys_mmap -> works in wasm)
21const O_STR: i64 = 385024 // HUD score string scratch (decimal digits + reversal temp)

functions

23func rgb(r: i64, g: i64, b: i64) -> i64 { return (r & 255) | ((g & 255) << 8) | ((b & 255) << 16) }
called by 2: mainrender_impl
25func fillr(base: i64, x0: i64, y0: i64, x1: i64, y1: i64, c: i64) -> i64
called by 1: render_impl
38func init_impl(base: i64) -> i64
called by 3: maininitmain
50func tick_impl(base: i64, dir: i64) -> i64
called by 3: maintickmain
72func render_impl(base: i64) -> i64
114func init() -> i64 { return init_impl(0) }
calls 1: init_impl
115func tick(dir: i64) -> i64 { return tick_impl(0, dir) }
calls 1: tick_impl
116func render() -> i64 { return render_impl(0) }
calls 1: render_impl
117func score() -> i64 { let st: *i64 = (0 + O_ST) as *i64; return st[2] }
118func fb_off() -> i64 { return O_FB }
119func ww() -> i64 { return W }
120func hh() -> i64 { return H }