Closes the two open issues and lands the pending unreleased batch: - #90: `Sprite { atlas: 1 }` routes esys_sprite through atlas_draw_ex (scale/flip/tint), so cell / cell_span / strip ids of any size draw through the engine sprite-render system. examples/library/sprite_atlas is the pixel-readback regression. - #91: `become` from an @On(Event) listener / global handler / plain function no longer segfaults the compiler; it emits @L_scene_leave() (a dispatch on the live scene id) so the leaving scene's on-exit runs. UI_* handles are readable from any code (widget table built on first use). examples/library/scene_menus covers it. - fix: a windowed `ludicc -o` build that reaches the audio runtime only through the atlas/Assets preload import now links audio.ll + AVFoundation (the audio backend link was gated on a game-level Audio.* call, so any windowed game declaring Sprite failed to link). - the hand-written "Unreleased" CHANGELOG section is converted to changesets under changes/ so `x release` generates it. - plus the batch: engine-driven retained UI + UiClicked event, Overlay phase, TileSkin tilemap-render system, Key.* constants, Font/Ui/File namespaces, Sprite.strip, prefabs, managers, countdown fields, enum-typed machines, layer @Queries, ludic.prefs / ludic.dungeon packages, Ai.seek pathing, Solids.solid2, cursor confine (mode 3) fix, shooter centre-aim fix, reserved-word function diagnostic. Verified: x test (124/124), x test-tools, check-impl, check-vocabulary, check-docs, docs-gen + docs-check, bootstrap-cfree (seed is a fixpoint). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
e9c2c51bc3
commit
ad548840c7
139 changed files with 58981 additions and 43671 deletions
57
examples/library/component_access.ludic
Normal file
57
examples/library/component_access.ludic
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# component_access.ludic — typed component access from an entity handle:
|
||||
# `Prop.of(e)` reads and writes fields, `Prop.has(e)` is safe for -1 and dead
|
||||
# handles, `Prop.count()` counts, `Prop.despawn_all()` clears; `countdown` fields
|
||||
# tick toward 0 each Update; `Enum.Variant` typed vars and machines. Prints:
|
||||
# 9 15 10 33 1 0 0 1 0 1 101 100 102 1 2 1 0
|
||||
program ComponentAccess {
|
||||
import "ludic.core/components.ludic"
|
||||
property Hero { roll_frames: int = 0, iframes: int = 0, flash: countdown = 0 }
|
||||
property Tag { n: int = 0 }
|
||||
model Player { Position, Hero }
|
||||
model Thing { Position, Tag }
|
||||
enum HeroState { Idle, Rolling, Swinging }
|
||||
var hero_state: HeroState = HeroState.Rolling
|
||||
var player: int = -1
|
||||
var frames: int = 0
|
||||
function step() -> void {
|
||||
machine hero_state {
|
||||
state Idle { print(100); become Swinging }
|
||||
state Rolling { print(101); become Idle }
|
||||
state Swinging { print(102); become Rolling }
|
||||
}
|
||||
}
|
||||
handler Tick phase Update {
|
||||
frames += 1
|
||||
if frames == 1 {
|
||||
player = spawn Player { Position { x: 3, y: 4 }, Hero { roll_frames: 9, flash: 3 } }
|
||||
spawn Thing { Position { x: 30, y: 40 }, Tag { n: 7 } }
|
||||
print(Hero.of(player).roll_frames) # 9
|
||||
Hero.of(player).iframes = 20
|
||||
Hero.of(player).iframes -= 5
|
||||
print(Hero.of(player).iframes) # 15
|
||||
let hero = Hero.of(player)
|
||||
hero.roll_frames = hero.roll_frames + 1
|
||||
print(Hero.of(player).roll_frames) # 10
|
||||
print(Position.of(player).x + Position.of(1).x) # 33
|
||||
print(Hero.has(player)) # 1
|
||||
print(Hero.has(1)) # 0
|
||||
print(Hero.has(-1)) # 0
|
||||
print(Tag.has(1)) # 1
|
||||
despawn 1
|
||||
print(Tag.has(1)) # 0
|
||||
print(Position.count()) # 1: the player
|
||||
spawn Thing { Position { x: 1 } }
|
||||
}
|
||||
if frames == 2 {
|
||||
step(); step(); step() # 101 100 102
|
||||
print(hero_state) # 1
|
||||
print(Position.count()) # 2: the player and the thing spawned after
|
||||
}
|
||||
if frames == 3 {
|
||||
print(Hero.of(player).flash) # ticked twice: 1
|
||||
Position.despawn_all()
|
||||
print(Position.count()) # 0
|
||||
quit()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue