ludic/tools/ludic-cli/ui_preview.ludic
Orkuncakilkaya 49b5e80af5 ludic ui-preview: ludic.ui components previewed for a studio over stdio (R5)
A prebuilt tool, bin/ludic-ui-preview (built by ludic-dev build, shipped beside ludic-lsp, run as
`ludic ui-preview [--font DIR]`): ludic.ui with a backend that records every draw call as a line,
and mock component classes the studio describes (load / model / calls). frame t runs ui_show at
interface time t; text is measured on the CPU with the game's font.json metrics; locale goes
through ludic.i18n; tree / box / rules inspect the frame. No game code, no GPU, no network. The wire
protocol is frozen as tools/ui-preview/protocol-v1.md; smoke.txt is a transcript to run.

ludic.ui gains, all additive: UiClass.make_of, UiBackend.said / emitted, UiRule.text / at (with
comment line breaks kept so rule lines count true, and a class's styles read under its .lss path),
and ui_root, ui_find, ui_rules_of, ui_rule_value, ui_building, ui_class, ui_class_load,
ui_file_forget, ui_errors_clear; ui_nine_cuts_into exported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 19:53:26 +03:00

19 lines
964 B
Text

# ---- ludic ui-preview ---------------------------------------------------------
# A game's ludic.ui components previewed for a studio over stdio: ludic.ui with a backend that
# records its draw calls, and component classes the studio describes. No game code, no GPU, no
# network. The studio spawns it; tools/ui-preview/protocol-v1.md is the contract.
#
# ludic ui-preview [--font DIR] the host, on stdin and stdout
function cmd_ui_preview() -> int {
var args = ""
var ai = 2
while ai < arg_count() {
args = `{args} {sh_single(arg(ai))}`
ai += 1
}
let bin = `{ludic_home()}bin/{exe_name("ludic-ui-preview")}`
if is_exec(bin) { return sh(`exec {sh_single(bin)}{args}`) }
if capture_line(`command -v {exe_name("ludic-ui-preview")} 2>/dev/null`) != "" { return sh(`exec {exe_name("ludic-ui-preview")}{args}`) }
err("ludic ui-preview: no bin/ludic-ui-preview in this install (a checkout builds it with: ludic-dev build)\n")
return 1
}