code wiki / (root) / nx_wasm_sandbox.nx

nx_wasm_sandbox.nx

buildroot/runtime/nx_wasm_sandbox.nx

5704 B127 linesdepth 0pulls 0 transitivereach 0 importersview sourcekind orphan librarytopic wasm
docsdependenciesstructsconstsfunctions

about

nx_wasm_sandbox.nx -- BROWSER-PLAYABLE sovereign Sandbox (falling-sand): BASE-RELATIVE integer core, runs native (-> PNG) AND in the browser (base = 0). NO float, NO JS logic, NO canvas drawing. CLICK a palette swatch (sand / water / wall / eraser), CLICK the grid to paint a brush; a cellular-automata tick makes sand pile, water flow, walls hold. Uses the click(x,y) export. init()/tick(input)/render()/score()/ww()/hh()/ fb_off()/click(x,y) = the wasm interface. license_tier: ORIGINAL

dependencies 0 imports · 0 importers

imports: none

imported by: nobody (leaf or entry point)

structs

none

consts

6const W: i64 = 180
7const H: i64 = 160
8const TOOLH: i64 = 20
9const CELL: i64 = 4
10const GW: i64 = 45 // W/CELL
11const GH: i64 = 35 // (H-TOOLH)/CELL
12const O_FB: i64 = 0 // framebuffer W*H i64
13const O_MAP: i64 = 230400 // map[GW*GH]: 0 empty,1 sand,2 water,3 wall (W*H*8)
14const O_ST: i64 = 243000 // scalars[16]: 0=sel 1=placed

functions

16func rgb(r: i64, g: i64, b: i64) -> i64 { return (r & 255) | ((g & 255) << 8) | ((b & 255) << 16) }
called by 2: matcolorrender_impl
17func matcolor(m: i64) -> i64
called by 1: render_impl calls 1: rgb
24func fillr(base: i64, x0: i64, y0: i64, x1: i64, y1: i64, c: i64) -> i64
called by 1: render_impl
37func init_impl(base: i64) -> i64
called by 1: init
45func click_impl(base: i64, x: i64, y: i64) -> i64
called by 1: click
66func tick_impl(base: i64, input: i64) -> i64
called by 1: tick
95func render_impl(base: i64) -> i64
called by 1: render calls 3: fillrrgbmatcolor
120func init() -> i64 { return init_impl(0) }
calls 1: init_impl
121func tick(input: i64) -> i64 { return tick_impl(0, input) }
calls 1: tick_impl
122func render() -> i64 { return render_impl(0) }
calls 1: render_impl
123func click(x: i64, y: i64) -> i64 { return click_impl(0, x, y) }
calls 1: click_impl
124func score() -> i64 { let st: *i64 = (0 + O_ST) as *i64; return st[1] }
125func fb_off() -> i64 { return O_FB }
126func ww() -> i64 { return W }
127func hh() -> i64 { return H }