Add atlas-spec loader with duplicate handling

loadAtlasDirs walks one level deep into each --atlas-dir, picks up
*/tiles.atlas.json, and builds bidirectional name/id maps. On
duplicate atlas_id across paths the first registration wins and a
warning string is returned (callers decide whether to print).
This commit is contained in:
Axel Meyer
2026-05-23 13:50:10 +02:00
parent cef9c5c9a2
commit a3ff2f5e6e
5 changed files with 156 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
{
"atlas_id": "atlas_a",
"atlas_version": 1,
"atlas_size_px": [64, 64],
"tile_size_px": 32,
"tiles": [
{ "id": 1, "name": "grass", "uv": [0, 0, 32, 32], "walkable": true },
{ "id": 2, "name": "stone", "uv": [32, 0, 32, 32], "walkable": false, "blocks_sight": true }
]
}

View File

@@ -0,0 +1,9 @@
{
"atlas_id": "atlas_b",
"atlas_version": 1,
"atlas_size_px": [64, 32],
"tile_size_px": 32,
"tiles": [
{ "id": 1, "name": "water", "uv": [0, 0, 32, 32], "walkable": false }
]
}