feat(stdlib): Tiled P0.5 — TMX/TSX reader over the XML reader (#68)
Tiled.read / Tiled.read_tsx (runtime/native/tiled.ludic): map the native
XML formats (TMX/TSX/TX) onto the SAME intermediate the JSON path produces
— a Value tree in Tiled's JSON schema — so one format-independent core
(P1) consumes either reader.
- tmx_to_value walks a <map> into {orientation, width/height, tilewidth/
height, tilesets[], layers[]}; every tile layer's <data> is decoded to a
dense GID int list (CSV split, or base64 -> zlib/gzip inflate ->
little-endian u32s), so a CSV .tmx and a base64 .tmj of the same map read
structurally identically.
- External tilesets keep the {firstgid, source} reference (as TMJ does);
embedded tilesets and standalone .tsx (tsx_to_value) inline full geometry
+ per-tile metadata (animation frames, collision objectgroup, class,
properties) for later phases.
- Object layers, shapes (rect/ellipse/point/polygon/polyline/text),
image/group layers and custom properties are parsed into the tree now so
P2/P4/P5 just read it.
- tmj_normalize decodes base64 `data` strings in a parsed .tmj so the JSON
path matches the XML path.
Proven by library/tiled_p05.ludic (30 assertions) incl. the in-repo Kenney
sampleMap.tmx + external sampleSheet.tsx and TMX-vs-TMJ structural
identity. Docs + inventory added; x test: 91 passed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
79776d1f6a
commit
071c268de7
11 changed files with 5721 additions and 4986 deletions
|
|
@ -607,6 +607,13 @@ function emit_ns_call(ns: pointer, meth: pointer, e: Node) -> Val {
|
|||
if (meth == "decode") { bare = "base64_decode"; push(labels, "src") }
|
||||
if (meth == "encode") { bare = "base64_encode"; push(labels, "src") }
|
||||
}
|
||||
# Tiled.* — Tiled map support (runtime/native/tiled.ludic, spliced on demand).
|
||||
# read/read_tsx produce the intermediate Value tree (#68); load/gid/resolve/
|
||||
# draw/prop operate on the loaded map model (#69+).
|
||||
if (ns == "Tiled") {
|
||||
if (meth == "read") { bare = "tiled_read"; push(labels, "path") }
|
||||
if (meth == "read_tsx") { bare = "tiled_read_tsx"; push(labels, "path") }
|
||||
}
|
||||
# #62: a package-provided namespace (declared with @Namespace(Foo)) that none
|
||||
# of the hardcoded core blocks matched — alias Foo.method to the bare function
|
||||
# foo_method (positional args), the same generic path the core aliases use.
|
||||
|
|
|
|||
10056
selfhost/ludicc.seed.ll
10056
selfhost/ludicc.seed.ll
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue