Window Package
window is an independently versioned official package. Git installs build it
from source and require SDL2 development files; it is not bundled into the Kelvra
runtime.
Importing the package
Section titled “Importing the package”const window = @import("github.com/kelvralang/window")Core lifecycle
Section titled “Core lifecycle”const win window.Window = window.create("Demo", 800i64, 600i64)
window.clear(win)window.present(win)window.close(win)The current API creates windows hidden by default. Visible manual demos call
window.show(win) explicitly.
Events and input
Section titled “Events and input”const evt window.Event? = window.pollEvent(win)
if (evt != null) { print(window.eventKind(evt))}Current input/event helpers include:
pollEvent(win) -> Event?eventKind(evt) -> streventKeyCode(evt) -> i64isKeyDown(win, keyCode) -> boolmouseX(win) -> i64mouseY(win) -> i64KEY_SPACEKEY_ESCAPE
Rendering helpers
Section titled “Rendering helpers”The package already exposes a small immediate-mode drawing surface:
window.clearRgb(win, 32i64, 64i64, 96i64)window.fillRect(win, 8i64, 8i64, 24i64, 24i64, 255i64, 0i64, 0i64)window.drawText(win, 8i64, 40i64, "Score: 12", 2i64, 255i64, 255i64, 255i64)window.present(win)window.delay(1i64)drawText uses a built-in bitmap monospace font, accepts printable ASCII,
supports \n for multi-line text, and clips against the window surface. The
scale argument must be at least 1.
That is enough for the rectangle-rendered Flappy Bird demo with an in-window
score HUD in
examples/flappy_bird.kel.
Demos in this repo
Section titled “Demos in this repo”Manual examples:
examples/window_open.kelexamples/window_events.kelexamples/flappy_bird.kel
Headless test coverage:
tests/sample_kelvra_window.keltests/sample_kelvra_window_render.kel
Build note
Section titled “Build note”Installing Window from Git requires CMake, a C++17 compiler, and SDL2 development files. The Kelvra runtime itself does not require SDL2.
Publishing the official package
Section titled “Publishing the official package”Window’s tag workflow builds target-specific convenience archives and attaches checksums to a GitHub Release. KELVRA does not consume GitHub Release archives as prebuilt dependencies. To offer prebuilt installation, publish each prepared target bundle to a configured registry:
kelvra publish --registry official --signing-key ./keys/release.toml .kelvra publish --registry official --target linux-arm64-gnu \ --native-artifact-dir ./dist/linux-arm64-gnu \ --signing-key ./keys/release.toml .The registry service URL, credentials, and signing key are deployment secrets; they are not stored in the package repository.