code wiki / (root) / nx_checkers_render.nx

nx_checkers_render.nx

buildroot/runtime/nx_checkers_render.nx

14248 B379 linesdepth 4pulls 4 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_checkers_render.nx -- bits-up HTML rendering + event dispatch for /checkers. Mirrors nx_tictactoe_render.nx pattern. HTML emitted via sys_write to sentinel fd 99; dist/_nishi/nishi-host.js captures + sets innerHTML. Click events route via data-action="<id>" to nx_chk_action. State block carries one extra "selected square" UI cell after the game cells so the renderer can highlight the selected source-piece + show legal destinations. Hash of game state stays in cells 0..67 (unchanged). Exports: nx_chk_render_init() -> *i64 nx_chk_render(s) -> i64 -- emits HTML to fd 99 nx_chk_action(s, act, a0, a1, a2, a3) -> i64 Action IDs (data-action): 1 = click square N (arg0 = 0..63) 2 = reset game 3 = set opponent (arg0: -1=human, 0=easy) 4 = set player side (arg0: 1=red, 2=black)

dependencies 4 imports · 1 importers

nx_syscalls.nx nx_tier.nx nx_prng.nx nx_checkers.nx nx_checkers_render.nx nx_chk_bits_up_e2e.nx

imports: nx_syscalls.nxnx_tier.nxnx_prng.nxnx_checkers.nx

imported by: nx_chk_bits_up_e2e.nx

structs

none

consts

26const NX_MAGIC_12345: i64 = 12345
28const NX_CHK_RENDER_FD: i64 = 99
30const NX_CHK_ACTION_CLICK_SQ: i64 = 1
31const NX_CHK_ACTION_RESET: i64 = 2
32const NX_CHK_ACTION_SET_OPPONENT: i64 = 3
33const NX_CHK_ACTION_SET_PLAYER: i64 = 4
36const NX_CHK_OFF_SELECTED: i64 = 68 // -1 if no selection
37const NX_CHK_OFF_PLAYER_SIDE: i64 = 69 // NX_CHK_RED or NX_CHK_BLACK
38const NX_CHK_OFF_OPPONENT: i64 = 70 // -1=human, 0=easy
39const NX_CHK_OFF_PRNG: i64 = 71 // pointer (as i64) to separately-allocated PRNG state
40const NX_CHK_RENDER_CELLS: i64 = 72

functions

44func _chk_strlen(s: *u8) -> i64
called by 1: _chk_w
50func _chk_w(s: *u8) -> i64
55func _chk_wn(n: i64) -> i64
called by 1: _chk_emit_board calls 2: sys_mmapsys_write
70func nx_chk_render_init() -> *i64
called by 1: main calls 3: sys_mmapnx_chk_newnx_prng_init
90func _chk_reset_in_place(s: *i64)
called by 1: nx_chk_action calls 1: nx_chk_new
118func _chk_emit_status(s: *i64) -> i64
160func _chk_emit_piece(piece: i64) -> i64
called by 1: _chk_emit_board calls 1: _chk_w
168func _chk_emit_board(s: *i64) -> i64
212func _chk_emit_opt(value: i64, is_selected: i64, label: *u8) -> i64
called by 1: _chk_emit_controls calls 1: _chk_w
226func _chk_emit_controls(s: *i64) -> i64
called by 1: nx_chk_render calls 2: _chk_w_chk_emit_opt
257func _chk_emit_version_banner() -> i64
called by 1: nx_chk_render calls 1: _chk_w
264func nx_chk_render(s: *i64) -> i64
282func _chk_handle_click(s: *i64, sq_idx: i64) -> i64
323func _chk_ai_take_turn(s: *i64)
343func nx_chk_action(s: *i64, action: i64, arg0: i64, arg1: i64,