code wiki / (root) / nx_wasm_thirdperson.nx

nx_wasm_thirdperson.nx

buildroot/runtime/nx_wasm_thirdperson.nx

5294 B119 linesdepth 1pulls 1 transitivereach 1 importersview sourcekind librarytopic wasm
docsdependenciesstructsconstsfunctions

about

nx_wasm_thirdperson.nx -- BROWSER-PLAYABLE sovereign Third-Person explorer: BASE-RELATIVE integer core, runs native (-> PNG) AND in the browser (base = 0). NO float, NO JS logic, NO canvas drawing. A FOLLOW CAMERA keeps the avatar centered while a world LARGER than the screen scrolls under it; move 4-directionally to collect every item then reach the goal (win). init()/tick(input)/render()/score()/ww()/hh()/fb_off() = the wasm interface; input bits 1=up 2=down 4=left 8=right. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_nishi_font_core.nx nx_wasm_thirdperson.nx nx_wasm_thirdperson_gate.nx

imports: nx_nishi_font_core.nx

imported by: nx_wasm_thirdperson_gate.nx

structs

none

consts

7const W: i64 = 128 // viewport
8const H: i64 = 112
9const WW: i64 = 288 // world
10const WH: i64 = 224
11const NI: i64 = 5
12const MOVE: i64 = 2
13const O_FB: i64 = 0 // framebuffer W*H i64
14const O_IX: i64 = 114688 // item world-x[16] (W*H*8)
15const O_IY: i64 = 114816
16const O_IG: i64 = 114944 // item collected[16]
17const O_ST: i64 = 115072 // scalars[16]: 0=wx 1=wy 2=collected 3=won 4=gx 5=gy
18const O_MSK: i64 = 115200
19const O_STR: i64 = 123392

functions

21func rgb(r: i64, g: i64, b: i64) -> i64 { return (r & 255) | ((g & 255) << 8) | ((b & 255) << 16) }
called by 1: render_impl
22func clampi(v: i64, lo: i64, hi: i64) -> i64 { if v < lo { return lo } if v > hi { return hi } return v }
23func iabs(v: i64) -> i64 { if v < 0 { return 0 - v } return v }
called by 1: tick_impl
25func fillr(base: i64, x0: i64, y0: i64, x1: i64, y1: i64, c: i64) -> i64
called by 1: render_impl
37func disc(base: i64, cx: i64, cy: i64, rad: i64, c: i64) -> i64
called by 1: render_impl
52func init_impl(base: i64) -> i64
called by 2: initmain
63func tick_impl(base: i64, input: i64) -> i64
called by 2: tickgoto calls 2: clampiiabs
81func render_impl(base: i64) -> i64
113func init() -> i64 { return init_impl(0) }
calls 1: init_impl
114func tick(input: i64) -> i64 { return tick_impl(0, input) }
calls 1: tick_impl
115func render() -> i64 { return render_impl(0) }
calls 1: render_impl
116func score() -> i64 { let st: *i64 = (0 + O_ST) as *i64; return st[2] }
117func fb_off() -> i64 { return O_FB }
118func ww() -> i64 { return W }
119func hh() -> i64 { return H }