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
|
|
@ -24,14 +24,45 @@ var snd_tab: pointers = null # handle (1-based) -> AVAudioPlayer pointer
|
|||
var snd_master: fixed = 1.0 # master volume, applied to every play
|
||||
var snd_rate: fixed = 1.0 # playback rate / pitch (1.0 = normal)
|
||||
var snd_music: int = 0 # the handle currently playing as music (0 = none)
|
||||
# the sound bank: sounds registered by name (Audio.define), played by name (Audio.play(name:))
|
||||
var snd_bank_name: pointers = null
|
||||
var snd_bank_id: words = null
|
||||
var snd_bank_n: int = 0
|
||||
|
||||
function audio_init() -> void {
|
||||
if snd_ready { return }
|
||||
snd_tab = bytes(AUDIO_CAP * 8) # one 8-byte pointer slot per handle
|
||||
fill(snd_tab, 0, AUDIO_CAP * 8) # malloc does not zero; empty slots must read null
|
||||
snd_bank_name = bytes(AUDIO_CAP * 8)
|
||||
snd_bank_id = words(AUDIO_CAP)
|
||||
snd_ready = true
|
||||
}
|
||||
|
||||
# ---- the sound bank: Audio.define(name, path) then Audio.play(name: "…") ------
|
||||
# Load a sound and remember it under a name; returns the handle (0 headless).
|
||||
function audio_define(name: pointer, path: pointer) -> int {
|
||||
audio_init()
|
||||
let id = audio_load(path)
|
||||
if snd_bank_n < AUDIO_CAP {
|
||||
snd_bank_name[snd_bank_n] = name
|
||||
snd_bank_id[snd_bank_n] = id
|
||||
snd_bank_n = snd_bank_n + 1
|
||||
}
|
||||
return id
|
||||
}
|
||||
# the handle registered under `name`, or 0
|
||||
function audio_named(name: pointer) -> int {
|
||||
audio_init()
|
||||
var i = 0
|
||||
while i < snd_bank_n {
|
||||
if snd_bank_name[i] == name { return snd_bank_id[i] }
|
||||
i = i + 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
function audio_play_named(name: pointer) -> void { audio_play(audio_named(name)) }
|
||||
function audio_play_music_named(name: pointer) -> void { audio_play_music(audio_named(name)) }
|
||||
|
||||
# Resolve a 1-based handle to its player pointer (null if out of range / empty).
|
||||
function audio_get(id: int) -> pointer {
|
||||
audio_init()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue