docs(0.S): the doc fences migrated by ludic migrate state; LANGUAGE.md's state section says what the tool and the checker do now; no module-level var left in the docs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
19fcf60599
commit
a476ec7976
79 changed files with 481 additions and 355 deletions
|
|
@ -17,18 +17,20 @@ Parameters:
|
|||
|
||||
```ludic
|
||||
program HighScore {
|
||||
var score: int = 0
|
||||
var best_score: int = 0
|
||||
|
||||
handler EarnPoints phase Update {
|
||||
score = score + 5
|
||||
best_score = max(best_score, score)
|
||||
if score >= 20 { quit() }
|
||||
state HighScoreState {
|
||||
score: int = 0
|
||||
best_score: int = 0
|
||||
}
|
||||
|
||||
handler ReportBest phase Render {
|
||||
handler EarnPoints(high_score_st: mut HighScoreState) phase Update {
|
||||
high_score_st.score = high_score_st.score + 5
|
||||
high_score_st.best_score = max(high_score_st.best_score, high_score_st.score)
|
||||
if high_score_st.score >= 20 { quit() }
|
||||
}
|
||||
|
||||
handler ReportBest(high_score_st: HighScoreState) phase Render {
|
||||
Screen.clear(Color.MidnightBlue)
|
||||
Screen.draw_number(x: 8, y: 8, value: best_score, color: Color.Gold, scale: 1)
|
||||
Screen.draw_number(x: 8, y: 8, value: high_score_st.best_score, color: Color.Gold, scale: 1)
|
||||
Screen.show()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,14 @@ Parameters:
|
|||
|
||||
```ludic
|
||||
program PrintScore {
|
||||
var score: int = 0
|
||||
state PrintScoreState {
|
||||
score: int = 0
|
||||
}
|
||||
|
||||
handler CountUp phase Update {
|
||||
score = score + 10
|
||||
print(score)
|
||||
if score >= 30 { quit() }
|
||||
handler CountUp(print_score_st: mut PrintScoreState) phase Update {
|
||||
print_score_st.score = print_score_st.score + 10
|
||||
print(print_score_st.score)
|
||||
if print_score_st.score >= 30 { quit() }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Parameters:
|
|||
|
||||
```ludic
|
||||
program LabelValue {
|
||||
var score: int = 250
|
||||
let score: int = 250
|
||||
|
||||
handler ReportScore phase Start {
|
||||
let label = string(score)
|
||||
|
|
|
|||
|
|
@ -13,18 +13,20 @@ Constructs the retained-UI tree you declared in a <code>ui</code> block, laying
|
|||
|
||||
```ludic
|
||||
program TitleMenu {
|
||||
var title_font: int = 0
|
||||
state TitleMenuState {
|
||||
title_font: int = 0
|
||||
}
|
||||
|
||||
ui MainMenu {
|
||||
panel id: Root w: 240 pad: 16 gap: 6 bg: 0x1a1a2c align: center {
|
||||
label text: "CHRONORIFT" font: title_font size: 24 fg: 0xffe060 align: center
|
||||
button id: NewGame text: "New Game" font: title_font size: 16 w: 200
|
||||
button id: Quit text: "Quit" font: title_font size: 16 w: 200
|
||||
label text: "CHRONORIFT" font: TitleMenuState.title_font size: 24 fg: 0xffe060 align: center
|
||||
button id: NewGame text: "New Game" font: TitleMenuState.title_font size: 16 w: 200
|
||||
button id: Quit text: "Quit" font: TitleMenuState.title_font size: 16 w: 200
|
||||
}
|
||||
}
|
||||
|
||||
handler Boot phase Start {
|
||||
title_font = Font.load("/System/Library/Fonts/Supplemental/Arial.ttf")
|
||||
handler Boot(title_menu_st: mut TitleMenuState) phase Start {
|
||||
title_menu_st.title_font = Font.load("/System/Library/Fonts/Supplemental/Arial.ttf")
|
||||
ui_build()
|
||||
Ui.open(UI_MainMenu)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue