canvas_backend.c (1882 lines) becomes canvas_window/input/draw/texture/
text/os/audio.c plus canvas_internal.h, one file per banner section the
monolith had already grown. Pure code motion: the node call-sequence
gate records an identical 413-call trace before and after.
The canvas branches in Makefile, mk/common.mk, and examples/Makefile no
longer append the backend file on top of the src/ find sweep — that
would have compiled every canvas TU twice. docs: BACKENDS.md path and
empty-TU wording, FEATURE_MATRIX.md stale 'approximated' note.
The Aero widget style derives its glass tints from whichever palette is
active, so a 13th palette entry was redundant. Remove THEME_AERO (and
its ini mirrors, locale label and picker slot); the style now defaults
to Sky. Saved theme ids beyond the shrunken count normalize through the
existing out-of-range fallback.
Projects without an explicit frame hook got a bare ScreenName() call in
the generated main: no drawing frame and no viewport argument, which
did not compile against screens lowered as fn(Rectangle viewport).
Wrap the call in BeginDrawing/BeginUIFrame and pass the screen
rectangle, mirroring what hosts do around DrawAppScreen. The example
font helper is now included in kryon_project.c when the app block asks
for the examples font, and the examples link rule compiles
kryon_project.c alongside the module so the binaries actually contain
main.
- examples/30_aero.kry: all-widget showcase pinned to Aero with live
palette/mode switching; the theme example's style clamp now accepts
THEME_STYLE_AERO
- examples/Makefile: the generic codegen rule ran k2b where it meant
k2c (from the kc->k2c rename), so examples with calls outside the
KRB vocabulary could not generate their C at all
- ui_tk_test: Aero round-trip, tokens, palette id/label and scheme
derivation checks
- API.md: document the style, UIAeroScheme and the THEME_AERO id
Profile: avatar circle+ring, name/handle, stats row with bound
counters, action rows, sign-out button. Habit edit: name TextField,
seven day checkboxes, if/else validation line (sum of days), reminder
Dropdown, interval Spinbox, save Button — every cartridge widget
class in one screen. Both byte-identical kry_sw == SDL.
Stat cards with state-bound counters (TextFormat), a seven-bar week
chart from guarded rects, axis labels. Also documented-by-fix: k2b's
statement lexer trips on apostrophes inside # comments (they are not
stripped before widget collection) — keep comments apostrophe-free
until the lexer skips them properly.
Pixel-measured from the reference frame: the dropdown box is radius-3
rounded on ALL corners (fill and border), width stored unscaled (391
phys), and the indicator is a diamond of converging pixel pairs
(measured at x404-409/y317-322), not a 'v' glyph. Text offset
bracketed; 0 optimal.
Native gate: structural 241 -> 229 of 307200 (0.07%), aa-only ~3970
within tolerance. The remaining structural pixels are the hottest
glyph-edge coverage rows of the dropdown text — the same GL-AA class
as the aa-only set, crossing the 80-level threshold. Geometry is
exact end to end. Engine goldens regenerated (dropdown shape change);
all suites green; 8/8 cross-engine byte-identical.
The per-glyph font trace killed the fallback theory (every glyph from
the latin subset, base 27) but exposed the real drift: raylib rtext.c
line 739 TRUNCATES advances ((int)(adv*scale)) and ui_text.c
truncates again — my rounding added up to +1px per glyph. kry_sw now
truncates stored sub-pixel advances identically: structural diffs
1530 -> 260.
The rest was dropdown geometry, measured from the reference frame:
radius-3 rounded corners on the left, square right corners, width
388 phys (345 logical), chevron position. Structural now 241,
aa-only ~4100 — the remaining structural is the last corner-curve
pixels plus the chevron glyph (native draws a chevron shape where
the cartridge renders a 'v' glyph).
Suites green: krb logic/asset, engine goldens (regenerated), 8/8
cross-engine byte-identical.
KFA1 glyph advances are now 1/256-px fixed point ((int)(adv*scale*256
+0.5) at bake; single rounding at draw/measure, matching ui_text.c's
float path). Spec updated.
The instrumented title run exposed the real screen content: the title
is 'Choose Language' (locale key), not 'Language' — resolving the
width anomaly. The cartridge now uses the traced strings, sizes,
and positions ('Choose Language' fs24 phys(159,32), 'Language' fs16
(45,273), 'Next' fs12 (230,377)); per-mille scale verified in-binary
(scale=1125, scale_px(141)=159).
Native parity 5765 -> 5179/307200 (98.3%). The residual is the
classic last mile: every glyph edge sits one sub-pixel off between
an exact integer blit and GL quad rasterization — closing it means
emulating the GPU's quad fill/sample rule in kry_sw. Cross-engine
8/8 byte-identical (after rebuilding the stale SDL host); suites and
goldens green.
The instrumented ui_text.c run pinned the native tier facts: ui
scale 1.125 (title tier base=27px for a 24 logical size), advances
w=9/adv=10 for 'L' — and glyph offsetY of +6 where raw stbtt gives
-15. raylib rtext.c line 730 adds (int)(ascent*scale) to every
offsetY: glyph offsets are line-top-relative. k2b_atlas now applies
the same shift; per-glyph values match the app trace exactly
('L' off=(1,6), 'a' (0,10)).
kry_sw's UI scale is per-mille (1.125 isn't expressible in integer
percent) with the same (int)(px*s+0.5) rounding as ScaleUIPx; the
native harness threads KRB_EXACT_UI_SCALE. The language cartridge
is now authored in logical units.
Native parity: 6423 -> 5765/307200; glyph positions track the
native within ~1-2px per element. Remaining: fractional-advance
storage (raylib keeps float advanceX; the u16 truncation drifts
~0.5px/glyph) and the title's measured width, under investigation.
Cross-engine: 8/8 byte-identical, suites green, goldens updated.
Measured geometry and palette from the first real native capture:
white background, centered title y37, label y284, dropdown x44/y299/
w391/h48 with #FBFBFB fill and #D3D3D3 border, text-only Next at
y379. krb-run gains KRB_RUN_THEME_LIGHT for the light palette.
Pixel diff vs the C build: 307200/307200 -> 6282/307200 (98.0%).
The remaining delta is glyph antialiasing parity between the KFA1
stb-baked atlas and inbe's raylib font pipeline — the last known
gap to literal 0.
New VM pieces: OP_MOD, and OP_NODE_SET (pops an i16 and patches a
node's x/y/w/h through a mutable node overlay allocated on first
use). TIME is now a first-class term in expressions. The k2b program
compiler was restructured around an ordered instruction stream
(updates, draws, guard/else brackets interleaved in source order) so
conditional assignments compile correctly — previously both branches
of an if always ran, last-write-wins. Updates accept full
term-or-term-arith-term right sides including % and TIME.
examples/26_inbe_whm_session.kry: the Wim Hof session as a cartridge —
TIME -> elapsed -> phase -> triangle wave -> animated ring radius via
AnimNode('ring0','w',&radius), breath counter with clamp, in/out
phase text. Verified across frames: t=0/600ms/5s produce the exact
expected phase, radius, and breath values. Eight exactness screens
byte-identical kry_sw == SDL.
Wim Hof config: rounds/breaths sliders with bound counters,
retention/recovery spinboxes, the breath ring preview, and the start
button — the CONTROL range-widget class in a real screen. Seven
exactness screens now byte-identical kry_sw == SDL.
TextFormat now compiles to bound TEXT nodes correctly: the dispatch
was missing entirely, and the value/x/y/font/color args sit one slot
over from plain Text. Habits screen: scrollable rows with completion
checkboxes, live 'Streak: %d days' counters bound to state, and
conditional status lines. Engine goldens refreshed (the file held a
pre-atlas hash). All six exactness screens byte-identical kry_sw ==
SDL.
KRB_FLAG_NAV buttons write a screen id to a state path on press
(cartridge-owned navigation; no host import). k2b compiles
NavButton(label, x, y, w, h, &state.screen, id). Screens are guarded
node ranges over one state field; examples/23_inbe_app.kry is Inner
Breeze as a single 6 MB cartridge — language, settings, and manual
screens with dropdowns, scroll, checkboxes, and the breath ring,
navigable end to end (verified: Next/Manual/Back transitions via
injected clicks). Scroll containers now draw a 1px outline instead
of a filled rect. All five exactness screens byte-identical
kry_sw == SDL.
Declarative port of inbe's settings/device tab: scroll container with
clamped wheel offset, language and orientation dropdowns, fullscreen
and keep-screen-on checkboxes, conditional hint rows via if/else.
k2b's Scroll() now parses ScaleUIPx content heights (atoi gave 0, so
the wheel clamp never engaged). Cross-engine exactness extended to
this screen: kry_sw == SDL byte-identical.
parse_term now returns consumed length (single-term guards like
'if (x == 0)' previously fell through to nothing while arithmetic
forms worked by accident). ButtonProps positional initializers
(label-first, Rectangle bounds) parse alongside the designated form.
Dropdown accepts an optional height argument.
examples/20_inbe_language.kry: a faithful declarative Inner Breeze
language-picker screen — title, bordered locale dropdown with five
options, if/else hint text, Next button — compiles to a cartridge
that renders complete in every engine with its embedded atlas.
KryScene->Scene, KryNode->Node, KryonProperty*->Property*,
KrySignal*->Signal*, KryTransform2D->Transform2D, and the
KRY_NODE_/KRY_SCENE_/KRYON_PROPERTY_/KRY_SIGNAL_ enum and macro
families to NODE_/SCENE_/PROPERTY_/SIGNAL_. Header guards keep their
original names (internal). The lowercase kry_ module namespaces
(kry_json, kry_term, ...) and the raymath-shadowing helpers
(KryVector2*, KryClamp, KryLerp) stay prefixed: their unprefixed names
collide with the raylib API surface kryon tracks.
A cartridge that comes out thin (inbe's pet screen: an egg widget,
locale text, Paragraphs) was silently missing everything k2b cannot
lower. The builder now tracks dropped call kinds per file and prints
one stderr line: 'k2b: <file>: N call kinds not in KRB: Paragraph x2
draw_egg x1 ...' - pet_screen.kry reports seven, which is the honest
content of the gap.
- k2b drops its KC_* macro aliases (56 uses) for the KIR_* names.
- CHANGELOG, plan docs, examples README, scene-source comments all say
k2c; the removed 512-statement cap entry no longer names the dead
KC_BODY_MAX constant.
- k2c_lower: fix '&&' within '||' precedence in the member-access skip
and three scope_stack[scope_top++] sequence-point UBs that -Wextra
on the Android host build surfaced.
The .kry->C compiler is now k2c, not kc. This is the first step toward making
Kir the single source of truth (k2c and k2b will both lower from Kir).
- cmd/kc/ -> cmd/k2c/ (directory moved; internal file names unchanged).
- Makefile: KC -> K2C, LEGACY_KC -> LEGACY_K2C, build/bin/kc -> build/bin/k2c.
- tests/kc_syntax_test.sh -> tests/k2c_syntax_test.sh (default binary updated).
- examples/Makefile: KC -> K2C; the two stale --emit-krb lines now use k2b.
- make test green (k2c_syntax_test passes via k2c).
LIB was a top-level (non-platform-tagged) archive, so in a tree shared
between FreeBSD and Linux the last OS to build won and the other side's
link pulled in foreign-libc objects. Archive it at $(BUILD_DIR)/libkryon.a
(build/$(platform)-$(arch)/libkryon.a), matching how the per-object files
and the raylib/box2d/curl archives are already laid out. Update examples/
Makefile to derive the host platform the same way and link against the
tagged path.
Include kry_term.h, kry_backend.h, and krb.h from the kryon umbrella so
apps reach them through the public header. Document the .krb load/bind/draw
flow and KrbMount in docs/API.md, mention kc --emit-krb in the README, and
add an examples Makefile target that builds the 02_buttons cartridge host.
CHANGELOG entries for the kry_term and krb slices.
TileMap (src/scene/node_tilemap.c):
- Renders a grid of tile IDs from a single tileset texture via DrawTexturePro
(raylib batches internally by texture). Tile IDs are 1-based; 0 = empty.
- TileLayer is a usage convention over TileMap (layered z-depth rendering),
not a separate runtime kind.
- Props: asset_path, tile size, tiles_per_row, map_w/h, world tile size,
tiles pointer (caller-owned), tint.
AudioSource (src/scene/node_audio_source.c):
- Wraps raylib's LoadSound/PlaySound (SFX) and LoadMusicStream/
PlayMusicStream/UpdateMusicStream (streaming music). Loads lazily on first
play via KryAudioSourcePlay; updates music each process tick; frees on
destroy. KryAudioSourcePlay/Stop are public controls.
- Props: asset_path, kind (sound/music), volume, pitch, loop, play state;
handle is a void* alloc sized by the impl (header stays free of raylib
audio struct dependencies).
With this, all twelve Game2D node kinds that were inert stubs at the start of
this project (Scene/Node2D/Camera2D/Sprite2D/AnimatedSprite2D/TileMap/
TileLayer/CollisionShape2D/Area2D/Body2D/Timer/AudioSource) have working
runtime implementations.
Example: examples/24_tilemap.kry (a 10x6 tile grid cycling 3 tile IDs).
Runtime:
- include/kry_animation.h + src/scene/kry_animation.c: animation = ordered
tracks of (time,value) keyframes; linear/step interpolation; hold-before/
hold-after clamping; KryAnimationApply samples at time t and writes position/
rotation/scale components onto target nodes via KryNodeGet
- src/scene/node_animation_player.c: AnimationPlayer node (registered on the
KRY_NODE_TIMER slot) advances the current animation each process tick and
applies it; on non-loop finish emits an 'animation_finished' signal via the
Phase 2 signal bus. Loop + play/pause state in AnimationPlayerProps
- src/scene/node_animated_sprite2d.c: AnimatedSprite2D cycles frames of a grid
sprite sheet at a given fps, drawing the current sub-rect via the shared
picture texture cache
- include/node2d_props.h: AnimationPlayerProps (holds up to 4 animations) +
AnimatedSprite2DProps + allocators
Example + test:
- examples/23_animation.kry: a Sprite2D whose y position is keyframe-animated
- tests/animation_test.c: linear/step interpolation, hold clamps, and
KryAnimationApply writing position.x/rotation; wired into 'make test'
Vendor Box2D v3.1.1 (erincatto/box2d) as a submodule; wired into
mk/vendor.mk (CMake static archive, samples/tests/benchmarks off) and
CPPFLAGS_BASE (-Ivendor/box2d/include). libkryon.a now depends on it.
Runtime:
- include/scene_tree.h: KryScene carries an opaque b2WorldId + physics_enabled;
KryScenePhysicsCreate/Destroy build/tear down the world; KryScenePhysicsTick
steps it via a function pointer installed by physics_world.c (keeps
scene_tree.c free of a box2d.h dependency)
- src/scene/physics_world.c: owns the only #include <box2d/box2d.h>; world
creation/step, body+shape creation helpers, transform sync
- src/scene/node_body2d.c: static/kinematic/dynamic body; creates b2Body on
ready, syncs transform on physics_process, debug-draws an outline
- src/scene/node_collision_shape2d.c: box/circle shape attached to the nearest
Body2D ancestor on ready
- src/scene/node_area2d.c: trigger volume (sensor) node
- include/node2d_props.h: Body2DProps/CollisionShape2DProps/Area2DProps +
allocators
- src/scene/scene_physics_internal.h: private bridge for Box2D-typed helpers
Example: examples/22_physics.kry (a dynamic box falling onto a static ground).
kc language:
- 'connect emitter.signal to target.handler' statement lowers to
KrySignalConnect(scene, emitter, "signal", target, "handler")
- 'emit emitter.signal' statement lowers to
KrySignalEmit(scene, emitter, "signal", KryonPropertyInt(0))
- Both recognized as statements in scene/screen bodies, source-tracked like
other calls
Example + tests:
- examples/21_signals.kry: connect + emit between two Node2D nodes
- tests/scene_property_test.c: property spec tables, name/index accessors,
kind-specific Sprite2D props, signal connect/emit dispatch, and
auto-disconnect on node removal; wired into 'make test'
kc compiler (.kry -> C):
- Recognize new top-level 'scene Name { ... }' form; emits a builder
void Name_kry_scene(KryScene *scene) via a new is_scene flag on KryFunction
and an _kry_scene suffix branch in kc_function_base_name
- New app{} directive 'scene Name' that makes kc emit a retained-tree main():
KrySceneRegisterBuiltins / KrySceneInit / run builder / tick+physics+draw
loop / KrySceneDestroy. Takes priority over the single-screen UI main()
- app_hook_c_name now also resolves scene builders (not just exact_name hooks)
- Single-screen picker skips scene builders so they don't hijack UI apps
Scene tree API:
- KryNodeSetPosition/SetRotation/SetScale/SetProps accessors so builders can
mutate nodes (C disallows assigning through an rvalue returned struct)
Example + tests:
- examples/20_scene.kry: camera + Sprite2D scene, the first retained-tree game
- tests/scene_tree_test.c: tree ops, transform composition, lifecycle, removal,
active-camera selection; wired into 'make test' as SCENE_TREE_TEST
- examples/Makefile: add 20_scene to the examples list
Verified end-to-end: .kry -> kc -> clean C -> object file with no warnings
Add an optional value_text_override parameter to DrawUISlider, UISliderNode, and Slider. When non-NULL it is rendered instead of the default "%d + suffix" formatting, so callers can display values like "1.8x". Passing NULL preserves the existing behavior.
The previous pass removed the redundant call/assignment verbs (draw,
native, set, widget) and the widget keywords (text/rect/line/background/
swatch). This pass removes the remaining bespoke sugar so the statement
language is just declarations, assignments, calls, and control flow:
Removed (now fatal errors with migration hints):
- advance x by N -> x += N
- clamp_min/max x N -> if (x < N) x = N
- c_rect name = .. -> name: Rectangle = (Rectangle){..}
- texture name = .. -> name: Texture2D = ..
- set_theme id mode -> SetCurrentTheme(id, mode)
- button label {..} -> if WidgetButton(x, y, w, h, label, style) {..}
- on key K {..} -> if (UIKeyPressed(K)) {..}
- on key_down K {..}-> if (UIKeyDown(K)) {..}
- event/on expr {..}-> if (expr) {..}
- icon_button .. {..}-> if DrawUIIconButton((UIIconButton){..}) {..}
Also moved the background/set_theme fatal-error arms ahead of the
line_is_c_uninit_decl heuristic in the dispatcher, since the heuristic
was swallowing them as bogus 'TYPE NAME' C declarations.
What remains in parse_statement: control flow (if/else/for/while/switch/
case/default/guard/return/break/continue/goto/labels), declarations
(name :=, name: T =), assignments (incl. compound), bare calls, enum,
and the two escape hatches (c, unused). Rewrote the 9 example files that
used button/on-key (22 sites). Extended kc_syntax_test.sh to assert each
removed sugar keyword now errors. make clean && make all test passes.
KRY_LANGUAGE_PLAN.md updated to document the final minimal statement set.
The Kry statement language had a tangle of overlapping verbs (draw,
native, set, widget, text, rect, line, background, swatch) that all did
minor variants of the same thing: emit a call or assignment statement.
This removes the redundant ones and replaces the widget keywords with an
ordinary library of functions, so 'widget' is a convention (a function
that draws) rather than compiler syntax.
Removed statement verbs (now fatal errors with a migration hint):
- draw / widget -> call the expression directly; bare call statements
already wrap with PushUIInspectSource/PopUIInspectSource, so
click-to-source keeps working with no keyword.
- native -> call the expression directly.
- set -> write the assignment/call directly.
- text/rect/line/background/swatch -> call the matching Widget* library
function (WidgetText, WidgetRect, WidgetLine, WidgetBackground).
Kept keywords earn their place: button, on/event, icon_button,
set_theme, advance, clamp_min/max, c_rect, texture, c, unused, and all
control flow.
New widget library (include/ui_widgets.h, src/ui/ui_widgets.c):
WidgetText, WidgetRect, WidgetLine, WidgetBackground, WidgetButton —
ordinary C functions wrapping the existing DrawUI* primitives, with the
same defaults the removed keywords used. Included via kryon.h.
Rewrote all 17 example .kry files to the verb-free syntax (positional
args; named args deferred to a later phase since kc has no parameter
table). Updated kc_syntax_test.sh: the 'valid' screen and cross-file
tests no longer use removed verbs, and new tests assert that each
removed verb errors with a migration message.
Regenerated icon assets pick up the freebsd/macos platform PNGs added
earlier.
make clean && make all test passes (kc syntax, raylib compat, runtime).
Replace the bare recent-projects welcome screen with a centered start
page: a New Project action that scaffolds project.kryon + a hello-world
main.kry into a chosen folder, a Recent Projects list, and an Examples
grid with one card per examples/*.kry. The sidebar is hidden when no
project is open so the start page fills the canvas; opening a .kry
selects its screen and shows the preview column.
Update examples to the current kc syntax: drop the removed `var` keyword
from all declarations (they already use `name: type = value`) and replace
the custom `set_theme` verb in 03_theme.kry with `native SetCurrentTheme`
so the generated C compiles. All 17 examples now transpile and build.
Fix the preview inspect overlay registering zero widgets. draw_preview_pane
restored the editor camera via SetUIInspectFrame(NULL) through SetUIFrame,
which wiped the widget list that DrawAppScreen had just populated. Restore
the camera directly instead, so the 17 preview widgets survive and
DrawUIInspectOverlay can outline them and click-to-source works.
Build with -fPIE in mk/common.mk so the static lib links into PIE
executables on PIE-default Linux toolchains.