docs: regenerate site from f094acfdb5

This commit is contained in:
ludic-docs-bot 2026-09-17 22:10:03 +00:00
commit 63c5ed9baf
975 changed files with 55427 additions and 0 deletions

54
kw-layer.html Normal file
View file

@ -0,0 +1,54 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>layer — Ludic</title>
<meta name="description" content="A named group of handlers inside a scene; layers render in declaration order.">
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
<main class="wrap item">
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <a href="api.html#scenes">Scenes &amp; layers</a> <span>›</span> <span class="here">layer</span></div>
<div class="item-head">
<span class="kind-badge kind-keyword">keyword</span>
<h1 id="top">layer</h1>
</div>
<code class="sig">layer Name { handlers }</code>
<div class="desc"><p>A <code>layer</code> groups handlers inside a scene, and <b>declaration order is draw order</b>: within a phase the active scene's layers run in the order they were written, so a <code>Hud</code> layer declared after a <code>World</code> layer paints its <code>Render</code> output on top. Layers are the natural unit for stacking a heads-up display over the play-field, or a menu over a paused world. A layer handler may use any phase except <code>Start</code> (boot-time setup belongs in the scene's <code>on enter</code>). Handlers that should run in every scene are declared outside any scene rather than in a layer.</p></div>
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program LayerExample {
property Position { column: int = 0, row: int = 0 }
model Player { Position }
var score: int = 0
scene Overworld start {
on enter { spawn Player { Position { column: 6, row: 6 } } }
layer World {
handler DrawWorld phase Render {
Screen.clear(Color.MidnightBlue)
for (current_position) in query [Position, {Player}] {
Screen.fill_rectangle(x: current_position.column * 16, y: current_position.row * 16, width: 16, height: 16, color: Color.LimeGreen)
}
}
}
layer Hud {
handler DrawScore phase Render {
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.show() # the last layer to draw presents the frame
}
}
}
}</pre></div>
<a class="back" href="api.html">← All symbols</a>
</main>
<script src="ludic-highlight.js"></script>
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
</body></html>