wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run
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>
This commit is contained in:
parent
5ffe50ed02
commit
19fcf60599
459 changed files with 17862 additions and 17603 deletions
|
|
@ -3,43 +3,45 @@
|
|||
import "ludic.ui"
|
||||
program UiSubmit {
|
||||
numbers float
|
||||
var said: string = ""
|
||||
var chat: string = ""
|
||||
var name: string = ""
|
||||
view Chat {
|
||||
chat = chat
|
||||
name = name
|
||||
on set_chat(v: string) { chat = v }
|
||||
on set_name(v: string) { name = v }
|
||||
on send(v: string) { said = said + "[" + v + "]" }
|
||||
state UiSubmitState {
|
||||
said: string = ""
|
||||
chat: string = ""
|
||||
name: string = ""
|
||||
}
|
||||
view Chat (ui_submit_st: mut UiSubmitState) {
|
||||
chat = ui_submit_st.chat
|
||||
name = ui_submit_st.name
|
||||
on set_chat(v: string) { ui_submit_st.chat = v }
|
||||
on set_name(v: string) { ui_submit_st.name = v }
|
||||
on send(v: string) { ui_submit_st.said = ui_submit_st.said + "[" + v + "]" }
|
||||
}
|
||||
const PAGE: string = "<ui><screen name='c'><input type='text' label='Say' value='{chat}' clear-on-submit on-change='set_chat(event.value)' on-submit='send(event.value)'/><input type='text' label='Name' value='{name}' on-change='set_name(event.value)' on-submit='send(event.value)'/></screen></ui>"
|
||||
function frame(i: UiInput) -> void {
|
||||
ui_input(i)
|
||||
ui_show("c", view_chat(), 0.0, 0.0, 400.0, 400.0)
|
||||
function frame(ui_st: mut UiState, i: UiInput) -> void {
|
||||
ui_input(ui_st, i)
|
||||
ui_show(ui_st, "c", view_chat(), 0.0, 0.0, 400.0, 400.0)
|
||||
}
|
||||
function press(tab: bool, enter: bool, pad: bool, typed: string) -> void {
|
||||
function press(ui_st: mut UiState, tab: bool, enter: bool, pad: bool, typed: string) -> void {
|
||||
let i = new UiInput
|
||||
i.tab = tab
|
||||
i.enter = enter
|
||||
i.pad_a = pad
|
||||
i.typed = typed
|
||||
frame(i)
|
||||
frame(new UiInput)
|
||||
frame(ui_st, i)
|
||||
frame(ui_st, new UiInput)
|
||||
}
|
||||
entry {
|
||||
ui_backend(new UiBackend)
|
||||
ui_load_text(PAGE, "c.xml")
|
||||
frame(new UiInput)
|
||||
press(true, false, false, "")
|
||||
press(false, false, false, "hi")
|
||||
press(false, true, false, "")
|
||||
let after = `{said} chat '{chat}'`
|
||||
press(false, false, false, "yo")
|
||||
press(false, false, true, "")
|
||||
press(true, false, false, "")
|
||||
press(false, false, false, "Ada")
|
||||
press(false, true, false, "")
|
||||
print(`{after} | {said} chat '{chat}' name '{name}'`)
|
||||
entry (ui_st: mut UiState, ui_submit_st: UiSubmitState) {
|
||||
ui_backend(ui_st, new UiBackend)
|
||||
ui_load_text(ui_st, PAGE, "c.xml")
|
||||
frame(ui_st, new UiInput)
|
||||
press(ui_st, true, false, false, "")
|
||||
press(ui_st, false, false, false, "hi")
|
||||
press(ui_st, false, true, false, "")
|
||||
let after = `{ui_submit_st.said} chat '{ui_submit_st.chat}'`
|
||||
press(ui_st, false, false, false, "yo")
|
||||
press(ui_st, false, false, true, "")
|
||||
press(ui_st, true, false, false, "")
|
||||
press(ui_st, false, false, false, "Ada")
|
||||
press(ui_st, false, true, false, "")
|
||||
print(`{after} | {ui_submit_st.said} chat '{ui_submit_st.chat}' name '{ui_submit_st.name}'`)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue