AssetScope

class AssetScope(resources: suspend (String) -> ByteArray)

The load entry: SVG assets load through it, arriving as ready scene-graph values.

Every load reads bytes through the reader the scope is built over. compose-resources generates its Res accessor per application module, so a running game supplies Res::readBytes; a headless session supplies plain file reads or an in-memory map and builds its world the same way, AssetScope(reader).run { … }. A failure thrown by the reader propagates unchanged. Assets arrive viewBox-centered on the CGA origin; world placement is the caller's to apply — a loaded node moves like any other scene-graph value, node * versor.

Constructors

Link copied to clipboard
constructor(resources: suspend (String) -> ByteArray)

Builds the scope over the byte reader every load reads through.

Functions

Link copied to clipboard
inline suspend fun <N : ShapeNode> load(path: String): N

Loads the single-shape SVG document at path as its typed leaf — load<PolygonNode>("files/sprite.svg") yields a PolygonNode.

Link copied to clipboard
inline suspend fun <N : ShapeNode> loadAll(path: String): List<N>

Loads every shape of the SVG document at path as typed leaves, in document order — the any-count load: loadAll<PolygonNode>("files/tiles.svg") yields a List<PolygonNode>.

Link copied to clipboard
suspend fun loadGroup(path: String): GroupNode

Loads the SVG document at path as a scene sub-tree.