Commit Graph
85 Commits
Author SHA1 Message Date
waozi 7b6048a9df canvas: split the backend into per-concern sources
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.
2026-08-18 22:29:08 -03:00
waozi eb9967ce29 theme: drop the dedicated Aero palette, keep the style palette-agnostic
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.
2026-08-18 18:08:54 -03:00
waozi 49206d66d4 k2c: emit a runnable main for screen-only apps
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.
2026-08-18 16:55:59 -03:00
waozi eac6c16ea4 docs: cover the Aero style with an example, tests and API notes
- 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
2026-08-18 16:10:15 -03:00
waozi c4424493cb build: avoid case-colliding makefiles 2026-08-17 20:55:08 -03:00
waozi f8f5cd4c71 ui: add retained declarative tree and typed events 2026-08-17 18:55:05 -03:00
waozi b3fdfc0d7b examples: profile and habit-edit screens — 11 cartridge screens
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.
2026-08-17 08:10:31 -03:00
waozi 6f5f8f56d4 examples: statistics screen cartridge
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.
2026-08-17 08:03:57 -03:00
waozi daa855fd0f dropdown: measured native shape — rounded fill+border r3, diamond indicator
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.
2026-08-17 07:53:22 -03:00
waozi 84f44c6278 language screen: truncating advances + native dropdown shape — structural 1530 -> 241
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.
2026-08-17 07:47:52 -03:00
waozi 6d9702870a atlas: sub-pixel advances; language cartridge from traced values
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.
2026-08-17 07:12:25 -03:00
waozi d11c4b0b5a atlas: raylib's ascent-shifted glyph offsets + per-mille UI scale
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.
2026-08-17 06:56:02 -03:00
waozi e7fde24712 language cartridge: matched to the native reference frame
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.
2026-08-17 06:01:58 -03:00
waozi 0b2c447d5d krb v2: animated geometry — WHM session screen runs live in-cartridge
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.
2026-08-16 23:35:48 -03:00
waozi f4fefc7264 examples: practice config screen cartridge (sliders, spinboxes)
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.
2026-08-16 23:15:45 -03:00
waozi da6a472139 examples: habits screen cartridge (bound streak counters)
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.
2026-08-16 23:12:49 -03:00
waozi f087c0654d krb v2: screen navigation — the whole app in one cartridge
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.
2026-08-16 23:01:39 -03:00
waozi 42a500fe08 examples: manual screen cartridge (scrolling guide + breath circle)
Long-form text in a scroll container plus the DrawCircleV/DrawRing
breath visual — the geometry nodes in a real screen. kry_sw == SDL
byte-identical.
2026-08-16 22:58:51 -03:00
waozi 2dda6f2f4a examples: settings screen cartridge (scroll + dropdowns + checkboxes)
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.
2026-08-16 22:54:18 -03:00
waozi 22f055ffd1 k2b: fix guard single-term parsing, positional ButtonProps, dropdown height
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.
2026-08-16 22:18:33 -03:00
waozi 2423b97a0c scene/property/signal/transform: drop the Kry/Kryon prefix from the public API
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.
2026-08-16 20:35:15 -03:00
waozi ccec103ebc k2b: report call kinds the KRB vocabulary cannot express
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.
2026-08-16 07:52:09 -05:00
waozi 577681423a kc is fully gone: CHANGELOG/docs/comments now say k2c
- 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.
2026-08-14 21:00:34 -05:00
waozi 2f11e1e773 Rename kc to k2c (kry-to-C compiler)
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).
2026-08-13 20:09:53 -05:00
waozi 50a7479148 Archive libkryon.a under the platform-tagged build dir
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.
2026-08-13 15:05:58 -05:00
waozi 5b15a1272b Expose kry_term and krb in kryon.h; document the cartridge API
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.
2026-08-12 19:03:36 -05:00
waozi 1757df0a5e Phase 6: TileMap + AudioSource nodes (all 12 Game2D kinds now implemented)
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).
2026-08-12 09:33:14 -05:00
waozi 5dd8d3a78b Phase 5: animation system (keyframe tracks, AnimationPlayer, AnimatedSprite2D)
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'
2026-08-12 09:30:19 -05:00
waozi e8eb0dd789 Phase 4: Box2D v3 physics integration
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).
2026-08-12 09:06:23 -05:00
waozi b394221990 Add kc signal language support, example, and property/signal tests
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'
2026-08-11 03:45:23 -05:00
waozi 6c0f79c53e Add kc scene-tree language support, example, and tests
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
2026-08-11 03:33:41 -05:00
waozi 2bb8640279 Add retained scene tree foundation and rename UI Sprite to Picture
- include/kry_math.h: Vector2 math and KryTransform2D (compose/point/camera)
- include/scene_tree.h + src/scene/scene_tree.c: KryScene/KryNode retained
  node tree with array arena, parent/child links, world-transform update,
  lifecycle vtable (ready/process/physics_process/draw), KrySceneTick/
  PhysicsTick/Draw driver
- include/node2d_props.h: Camera2DProps, Sprite2DProps
- Rename UI Sprite widget to Picture (raylib owns Image as a struct):
  ui_sprite.h -> ui_picture.h, SpriteProps -> PictureProps,
  UISpriteFit -> UIPictureFit, UI_SPRITE_FIT_* -> UI_PICTURE_FIT_*,
  Sprite() -> Picture(); extract shared texture cache to
  src/ui/ui_picture_cache.c (KryLoadPictureTexture, KryPictureFitRect)
  shared by the Picture widget and the upcoming Sprite2D scene node
- Migrate example, docs, node registry to the Picture name
2026-08-11 03:11:34 -05:00
waozi 92ae0b4786 Allow custom value text on Slider widget
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.
2026-08-11 02:46:04 -05:00
waozi c9b8e27e4c Canonicalize widget API 2026-08-09 19:52:01 -03:00
waozi 3a6111c6ec fix sprite example syntax 2026-08-09 12:48:31 -03:00
waozi 0d360a0160 clean kryon app api 2026-08-09 12:44:52 -03:00
waozi eb8c1d359a Add Material theme style widgets 2026-08-08 15:05:02 -03:00
waozi d07078d2b2 Move UI runtime to declarative nodes 2026-08-06 07:15:55 -03:00
waozi 1c4bd145d9 Simplify theme style selection 2026-08-05 17:58:40 -03:00
waozi 90e759af65 Support standalone KITE IDE 2026-08-01 09:59:24 -03:00
waozi 63a8c366a2 Finish removing Kry sugar verbs — language is now minimal
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.
2026-07-25 17:04:29 -05:00
waozi 236ea20a1a Remove redundant Kry verbs; widgets are now a library
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).
2026-07-25 12:54:52 -05:00
waozi ce2bddba02 Add Kryon IDE start page and fix preview inspection
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.
2026-07-24 20:16:11 -05:00
waozi 93913f12a3 Improve Kry language and generic APIs 2026-07-23 13:44:45 -03:00
waozi bd4a4b1948 Make Kry C imports explicit 2026-07-21 19:26:09 -03:00
waozi 6a79813efa Build out Kryon IDE workflow 2026-07-20 23:14:07 -03:00
waozi 137f6ac413 Rename Flint runtime to Kryon 2026-07-20 11:25:19 -03:00
waozi 2123449504 Add Kryon widget inspection lifecycle 2026-07-20 10:56:27 -03:00
waozi f651980876 Add Flint source view widget 2026-07-19 10:39:35 -03:00
waozi 200ce63511 Refine cascading tree file browser 2026-07-19 09:53:21 -03:00