- `[a, b, c]` list literals (E_LIST → emit_list); static_type learns slice-element, `new T`, list, string and literal kinds - `x op= y` lowers through the same path as `x = x op y` (emit_bin_vals): fixed `*=`/`/=` use the Q16.16 64-bit paths, string `+=` concatenates, int→long widens; unary `-` keeps a fixed operand's type (arith_ty) - one `unescape()` table for "strings", 'chars' and `interpolation`; `'\''`, `'\\'`, `'\"'` no longer read as 0; unterminated char literals and unexpected characters are errors instead of silently skipped - every diagnostic is `file:line: error: msg` (g_parse_file / g_err_file, Node.file + Node.line set by node()); tok_desc() in expectation errors; duplicate `function` names and unknown `phase` names are reported in source terms (phase_id used to default unknown phases to Overlay) - interpolation holes skip braces inside string literals - hand-IR preludes move from the user `@fn_` prefix to `@lp_` so a user `is_ws` / `str_eq` / `path_join` no longer collides at link time - `@ClearColor(expr)` accepts any constant expression; `Os.pid()` added (docs page + inventory); `str_starts()` in support/str - main.ludic: `else if` flag ladder, char literals, stale script comments - examples/lang/operators.ludic covers all of the above; os.ludic covers Os.pid; docs pages for Os.pid and the Overlay phase; ten changesets - reseeded: selfhost/ludicc.seed.ll is the new compiler's own fixpoint Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
41 lines
1.4 KiB
Markdown
41 lines
1.4 KiB
Markdown
---
|
|
id: phase-overlay
|
|
name: Overlay
|
|
category: phases
|
|
kind: phase
|
|
tokens: Overlay
|
|
sig: phase Overlay
|
|
tip: The HUD pass — runs after Render and after every engine-owned drawing system.
|
|
order: 6
|
|
---
|
|
|
|
`Overlay` runs after `Render` and after every engine-owned drawing system (sprites, lights, the scene's `shows` menu), so a `handler … phase Overlay` paints on top of the finished world: health bars, score, prompts, a boss bar. With `@ClearColor` the engine owns the clear and the present, so an `Overlay` handler only draws — no `Screen.clear`, no `Screen.show`. Like `Render`, it should read the world and never change it.
|
|
|
|
```ludic
|
|
program OverlayExample {
|
|
property Position { column: int = 0, row: int = 0 }
|
|
model Player { Position }
|
|
|
|
const TILE_SIZE: int = 16
|
|
var score: int = 0
|
|
|
|
handler PlacePlayer phase Start {
|
|
spawn Player { Position { column: 5, row: 6 } }
|
|
}
|
|
|
|
@ClearColor(Color.MidnightBlue)
|
|
handler DrawWorld phase Render {
|
|
for (current_position) in query [Position, {Player}] {
|
|
Screen.fill_rectangle(
|
|
x: current_position.column * TILE_SIZE,
|
|
y: current_position.row * TILE_SIZE,
|
|
width: TILE_SIZE, height: TILE_SIZE, color: Color.LimeGreen)
|
|
}
|
|
}
|
|
|
|
handler DrawHud phase Overlay {
|
|
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)
|
|
}
|
|
}
|
|
```
|