These libraries are experimental. APIs may change without notice. Generated from source with koruc 0.1.7 on 8/19/2026.

raylib

@korulang/raylib@0.0.1

raylib for Koru — leak-proof windows, frame-loop-as-effect-branch, and drawing with phantom obligations

raylib/index.kz · 15 tors

@korulang/raylib — raylib for Koru (v0: window + frame loop + basic drawing) · 23 more lines
@korulang/raylib — raylib for Koru (v0: window + frame loop + basic drawing) Lifts raylib's window/drawing core behind phantom obligations. The C footguns this compiles away: 1. InitWindow() must be paired with CloseWindow() — forget it and the GL context / window leaks. Here the window lifecycle is ASYMMETRIC (opened -> active -> closed, see the lifecycle section below): an active window's forgotten close is auto-healed (unique discharger) or a KORU030 under --auto-discharge=disable — and a window that is opened but NEVER RENDERED is a KORU030 outright, in both modes: allocate- without-use has no discharge path at all. 2. Drawing outside a BeginDrawing()/EndDrawing() bracket is a silent no-op or corruption. Here every draw call borrows a *Frame<frame> handle that only exists inside the `! frame` effect-branch body — drawing outside a frame is not expressible. 3. Forgetting EndDrawing() hangs the swap chain. Here the engine owns the bracket: the frame body inlines between Begin and End, so the user cannot omit it (same safe-by-construction shape as sqlite3's `! row` iteration, which owns sqlite3_finalize). House style follows evp/index.kz and sqlite3/index.kz: `<state!>` grants an obligation, `<!state>` consumes it, bare `<state>` borrows.

Phantom lifecycles

Derived from the phantom labels in the declarations below — state! issues an obligation the compiler will chase, !state discharges it, a bare state holds it without moving it. Nothing here is hand-drawn.

Window 2 states opened!active!
Frame 1 state frame!
Texture 1 state loaded!

window.open

<opened!> index.kz:83

window.open.hidden

<opened!> index.kz:99

window.fps

<opened> index.kz:123

window.activate

<!opened><active!> index.kz:140

window.close

<!active> index.kz:146

frames

<!opened|!active><frame!><active!> index.kz:166

release.frame

<!frame> index.kz:188

texture.gen.color

<opened|active><loaded!> index.kz:237

texture.load

<opened|active><loaded!> index.kz:253

texture.unload

<!loaded> index.kz:266

draw.rect

<frame> index.kz:278

draw.texture

<frame><loaded> index.kz:285

draw.clear

<frame> index.kz:292

draw.text

<frame> index.kz:299