Commit Graph
36 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 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 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 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 0d360a0160 clean kryon app api 2026-08-09 12:44:52 -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 912f18638a Add pragmatic Tk-style UI toolkit 2026-07-19 00:46:20 -03:00
waozi 93c9fec4bd Add Flint editor overlay prototype 2026-07-18 19:05:17 -03:00
waozi a462581680 Add Clay and remove fontchop 2026-07-18 07:29:00 -03:00
waozi d606232116 Use fontchop submodule for UI fonts 2026-07-15 23:36:23 -03:00
waozi 62ce5376d1 Add Flint release automation 2026-07-12 00:06:29 -03:00
waozi 6f685051f6 Reorganize Flint sources and profile icons 2026-07-11 13:08:04 -03:00
waozi dc83383773 build: update Makefiles for moved sources (ui, lyra, file_dialog) and use wildcard SRCS 2026-07-11 12:41:17 -03:00
waozi 06d0d82ec3 Generate Raylib backend wrappers 2026-07-10 23:51:06 -03:00
waozi 4d8203135e Expose Raylib API through Flint 2026-07-10 23:32:08 -03:00
waozi 97e1ceaa89 Share Raylib build rules across Flint apps 2026-07-10 22:55:24 -03:00
waozi aa2476bc15 Update examples and docs for adaptive modals 2026-07-10 01:30:22 -03:00
waozi 965f27d6e7 Use external helpers for desktop file dialogs 2026-07-09 19:25:26 -03:00
waozi d981aff430 Rename public API to raylib-style names 2026-07-09 15:42:55 -03:00
waozi 398b6daa21 Add native FreeBSD support 2026-07-09 13:25:23 -03:00
waozi c67925d9ae Enable async support for web examples 2026-06-27 10:48:34 -03:00
waozi 7dc8c90f7c Vendor raylib through Flint build rules 2026-06-26 23:55:07 -03:00
waozi 12cb343610 Publish web examples with docs site 2026-06-26 23:42:41 -03:00
waozi e7deb0a353 Use chopped fonts in examples 2026-06-24 20:08:34 -03:00
waozi 4f417cb90a Bundle font chopping tooling and fix examples 2026-06-24 20:01:29 -03:00
waozixyz b622cb5213 add simple examples 2026-06-09 21:47:50 -03:00