nx_wasm_sandbox.nx
buildroot/runtime/nx_wasm_sandbox.nx
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
| 6 | const W: i64 = 180 |
| 7 | const H: i64 = 160 |
| 8 | const TOOLH: i64 = 20 |
| 9 | const CELL: i64 = 4 |
| 10 | const GW: i64 = 45 // W/CELL |
| 11 | const GH: i64 = 35 // (H-TOOLH)/CELL |
| 12 | const O_FB: i64 = 0 // framebuffer W*H i64 |
| 13 | const O_MAP: i64 = 230400 // map[GW*GH]: 0 empty,1 sand,2 water,3 wall (W*H*8) |
| 14 | const O_ST: i64 = 243000 // scalars[16]: 0=sel 1=placed |
functions
| 16 | func rgb(r: i64, g: i64, b: i64) -> i64 { return (r & 255) | ((g & 255) << 8) | ((b & 255) << 16) } |
| 17 | func matcolor(m: i64) -> i64 |
| 24 | func fillr(base: i64, x0: i64, y0: i64, x1: i64, y1: i64, c: i64) -> i64 called by 1: render_impl |
| 37 | func init_impl(base: i64) -> i64 called by 1: init |
| 45 | func click_impl(base: i64, x: i64, y: i64) -> i64 called by 1: click |
| 66 | func tick_impl(base: i64, input: i64) -> i64 called by 1: tick |
| 95 | func render_impl(base: i64) -> i64 |
| 120 | func init() -> i64 { return init_impl(0) } calls 1: init_impl |
| 121 | func tick(input: i64) -> i64 { return tick_impl(0, input) } calls 1: tick_impl |
| 122 | func render() -> i64 { return render_impl(0) } calls 1: render_impl |
| 123 | func click(x: i64, y: i64) -> i64 { return click_impl(0, x, y) } calls 1: click_impl |
| 124 | func score() -> i64 { let st: *i64 = (0 + O_ST) as *i64; return st[1] } |
| 125 | func fb_off() -> i64 { return O_FB } |
| 126 | func ww() -> i64 { return W } |
| 127 | func hh() -> i64 { return H } |