code wiki / (root) / nx_desktop_game.nx

nx_desktop_game.nx

buildroot/runtime/nx_desktop_game.nx

7352 B186 linesdepth 7pulls 12 transitivereach 2 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_desktop_game.nx -- the shared NATIVE GAME SURFACE (no wasm, no JS, no third-party anything): window + server keymap + event pump into nx_input_abstract + banded framebuffer blit, extracted from nx_desktop_breeders the moment a second native client (craft) needed the same machinery -- migrate-on-touch, one definition. A client composes: dg_setup -> dg_keymap -> loop { dg_pump -> its own step/render -> dg_blit } -- the game organ stays byte-identical to its wasm build; only the surface differs. dg_prove_surface is the shared selftest core (blit accepted + pixmap put->get byte round-trip) so every client's proof battery stays honest without re-implementing it. license_tier: ORIGINAL

dependencies 7 imports · 2 importers

nx_syscalls.nx nx_x11_paint.nx nx_x11_pixmap.nx nx_x11_get_image.nx nx_x11_put_image.nx nx_x11_keyboard.nx nx_input_abstract.nx nx_desktop_game.nx nx_desktop_breeders.nx nx_desktop_craft.nx

imports: nx_syscalls.nxnx_x11_paint.nxnx_x11_pixmap.nxnx_x11_get_image.nxnx_x11_put_image.nxnx_x11_keyboard.nxnx_input_abstract.nx

imported by: nx_desktop_breeders.nxnx_desktop_craft.nx

structs

none

consts

16const DG_MAGIC_4096: i64 = 4096
18const DG_FRAME_MS: i64 = 33

functions

21func dg_poll_in(pfd: *u8, fd: i64, timeout_ms: i64) -> i64
called by 4: mainmaindg_pumpdg_pump2 calls 1: sys_poll
38func dg_dispatch(inp: *i64, ev: *u8, vk_table: *i64) -> i64
called by 2: dg_pumpdg_dispatch2 calls 1: ia_key
56func dg_pump(conn: *X11Conn, inp: *i64, ev: *u8, pfd: *u8, vk_table: *i64) -> i64
72func dg_dispatch2(inp: *i64, ev: *u8, vk_table: *i64, mctx: *i64) -> i64
called by 1: dg_pump2 calls 3: ia_padia_lookdg_dispatch
101func dg_pump2(conn: *X11Conn, wid: i64, w: i64, h: i64,
122func dg_blit(conn: *X11Conn, wid: i64, gc: i64, fbp: *i64, w: i64, h: i64, zbuf: *u8) -> i64
129func dg_setup(title: *u8, tlen: i64, w: i64, h: i64, out: *i64) -> i64
149func dg_kc_for(vk_table: *i64, vk: i64) -> i64
called by 2: mainmain
161func dg_prove_surface(conn: *X11Conn, wid: i64, gc: i64, fbp: *i64,
184func main() -> i64