ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic 1804 vars into 126 states, 64 into lets; 23498 edits in 460 files Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
19 lines
947 B
Text
19 lines
947 B
Text
# ui_box.ludic — what a host reads from outside the interface: ui_scale(), the scale it is drawn at
|
|
# (the renderer's), and ui_box("id"), where an element was laid out when its screen was last shown,
|
|
# in screen pixels (null for one that is not there) - to frame a 3D view beside a panel.
|
|
import "ludic.ui"
|
|
program UiBox {
|
|
numbers float
|
|
const PAGE: string = "<ui><style>.side { width: 100px; height: 60px; margin: 10px }</style><screen name='b'><p>title</p><div id='panel' class='side'/></screen></ui>"
|
|
function scale() -> float { return 1.5 }
|
|
entry (ui_st: mut UiState) {
|
|
let b = new UiBackend
|
|
b.scale = fn scale
|
|
ui_backend(ui_st, b)
|
|
ui_load_text(ui_st, PAGE, "b.xml")
|
|
ui_show(ui_st, "b", null, 20.0, 30.0, 800.0, 600.0)
|
|
let p = ui_box(ui_st, "panel")
|
|
let none = ui_box(ui_st, "nothing")
|
|
print(`scale {ui_scale(ui_st)} | panel {int(p.x)},{int(p.y)} {int(p.w)}x{int(p.h)} | missing {none == null}`)
|
|
}
|
|
}
|