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
|
|
@ -18,15 +18,17 @@ Parameters:
|
|||
|
||||
```ludic
|
||||
program ClearBackground {
|
||||
var elapsed_frames: int = 0
|
||||
|
||||
handler CountFrames phase Update {
|
||||
elapsed_frames = elapsed_frames + 1
|
||||
state ClearBackgroundState {
|
||||
elapsed_frames: int = 0
|
||||
}
|
||||
|
||||
handler DrawWorld phase Render {
|
||||
handler CountFrames(clear_background_st: mut ClearBackgroundState) phase Update {
|
||||
clear_background_st.elapsed_frames = clear_background_st.elapsed_frames + 1
|
||||
}
|
||||
|
||||
handler DrawWorld(clear_background_st: ClearBackgroundState) phase Render {
|
||||
Screen.clear(Color.MidnightBlue)
|
||||
Screen.draw_number(x: 8, y: 8, value: elapsed_frames, color: Color.White, scale: 1)
|
||||
Screen.draw_number(x: 8, y: 8, value: clear_background_st.elapsed_frames, color: Color.White, scale: 1)
|
||||
Screen.show()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,16 +22,18 @@ Parameters:
|
|||
|
||||
```ludic
|
||||
program ScoreHud {
|
||||
var score: int = 0
|
||||
|
||||
handler EarnPoints phase Update {
|
||||
score = score + 1
|
||||
state ScoreHudState {
|
||||
score: int = 0
|
||||
}
|
||||
|
||||
handler DrawWorld phase Render {
|
||||
handler EarnPoints(score_hud_st: mut ScoreHudState) phase Update {
|
||||
score_hud_st.score = score_hud_st.score + 1
|
||||
}
|
||||
|
||||
handler DrawWorld(score_hud_st: ScoreHudState) phase Render {
|
||||
Screen.clear(Color.MidnightBlue)
|
||||
Screen.draw_text(x: 6, y: 4, text: "SCORE", color: Color.White, scale: 1)
|
||||
Screen.draw_number(x: 52, y: 4, value: score, color: Color.Gold, scale: 1)
|
||||
Screen.draw_number(x: 52, y: 4, value: score_hud_st.score, color: Color.Gold, scale: 1)
|
||||
Screen.show()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,10 +22,12 @@ Parameters:
|
|||
|
||||
```ludic
|
||||
program TitleScreen {
|
||||
var elapsed_frames: int = 0
|
||||
state TitleScreenState {
|
||||
elapsed_frames: int = 0
|
||||
}
|
||||
|
||||
handler CountFrames phase Update {
|
||||
elapsed_frames = elapsed_frames + 1
|
||||
handler CountFrames(title_screen_st: mut TitleScreenState) phase Update {
|
||||
title_screen_st.elapsed_frames = title_screen_st.elapsed_frames + 1
|
||||
}
|
||||
|
||||
handler DrawWorld phase Render {
|
||||
|
|
|
|||
|
|
@ -18,11 +18,13 @@ Parameters:
|
|||
|
||||
```ludic
|
||||
program StatusLine {
|
||||
var elapsed_frames: int = 0
|
||||
state StatusLineState {
|
||||
elapsed_frames: int = 0
|
||||
}
|
||||
|
||||
handler UpdateStatus phase Update {
|
||||
elapsed_frames = elapsed_frames + 1
|
||||
Screen.status(text: `frame {elapsed_frames}`)
|
||||
handler UpdateStatus(status_line_st: mut StatusLineState) phase Update {
|
||||
status_line_st.elapsed_frames = status_line_st.elapsed_frames + 1
|
||||
Screen.status(text: `frame {status_line_st.elapsed_frames}`)
|
||||
}
|
||||
|
||||
handler DrawWorld phase Render {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue