nx_wasm_shmup.nx
buildroot/runtime/nx_wasm_shmup.nx
about
nx_wasm_shmup.nx -- BROWSER-PLAYABLE sovereign Shoot-'em-up: BASE-RELATIVE integer core, the SAME code runs
native (base = a real mmap -> render a frame to PNG for eyeball verify) AND in the browser (base = 0 = our
sovereign WASM linear memory). NO float, NO JS logic, NO 3rd-party canvas drawing. Real-time: the shim's
rAF loop calls tick(input) every frame with the held-key bitmask (1=left 2=right 4=shoot); the core moves
the ship, fires a bullet, advances it, kills descending enemies, respawns waves endlessly, and game-overs
if a wave reaches the ship line (shoot restarts). HUD score drawn by our OWN font (no JS/canvas text).
init()/tick(input)/render()/score()/ww()/hh()/fb_off() are the wasm interface (auto-exported by nx_wasm.nx).
license_tier: ORIGINAL
dependencies 1 imports · 1 importers
imports: nx_nishi_font_core.nx
imported by: nx_wasm_shmup_gate.nx
structs
| none |
consts
| 10 | const W: i64 = 160 |
| 11 | const H: i64 = 192 |
| 12 | const NE: i64 = 6 |
| 13 | const SY: i64 = 176 // ship row |
| 14 | const EYSTART: i64 = 20 // wave spawn y |
| 15 | const O_FB: i64 = 0 // framebuffer W*H i64 (packed RGB) at offset 0 |
| 16 | const O_EX: i64 = 245760 // enemy x[16] (W*H*8) |
| 17 | const O_EA: i64 = 245888 // enemy alive[16] |
| 18 | const O_ST: i64 = 246016 // scalars[16]: 0=sx 1=bx 2=by 3=bactive 4=score 5=wave_count 6=ey 7=gameover 8=tick |
| 19 | const O_MSK: i64 = 246144 // HUD glyph scratch mask (base-relative -> no sys_mmap, lowers to wasm) |
| 20 | const O_STR: i64 = 254336 // HUD score string scratch |
functions
| 22 | func rgb(r: i64, g: i64, b: i64) -> i64 { return (r & 255) | ((g & 255) << 8) | ((b & 255) << 16) } called by 1: render_impl |
| 24 | func fillr(base: i64, x0: i64, y0: i64, x1: i64, y1: i64, c: i64) -> i64 called by 1: render_impl |
| 37 | func spawn_wave(base: i64) -> i64 |
| 48 | func init_impl(base: i64) -> i64 |
| 55 | func tick_impl(base: i64, input: i64) -> i64 |
| 82 | func render_impl(base: i64) -> i64 |
| 127 | func init() -> i64 { return init_impl(0) } calls 1: init_impl |
| 128 | func tick(input: i64) -> i64 { return tick_impl(0, input) } calls 1: tick_impl |
| 129 | func sfx_event() -> i64 { let st: *i64 = (0 + O_ST) as *i64; let e: i64 = st[9]; st[9] = 0; return e } // 1=shoot 2=kill 3=gameover; cleared on read |
| 130 | func render() -> i64 { return render_impl(0) } calls 1: render_impl |
| 131 | func score() -> i64 { let st: *i64 = (0 + O_ST) as *i64; return st[4] } |
| 132 | func fb_off() -> i64 { return O_FB } |
| 133 | func ww() -> i64 { return W } |
| 134 | func hh() -> i64 { return H } |