@codexo/exojs-tiled 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +134 -71
  2. package/dist/esm/TiledLayer.d.ts +72 -0
  3. package/dist/esm/TiledLayer.js +117 -0
  4. package/dist/esm/TiledLayer.js.map +1 -0
  5. package/dist/esm/TiledMap.d.ts +57 -72
  6. package/dist/esm/TiledMap.js +362 -23
  7. package/dist/esm/TiledMap.js.map +1 -1
  8. package/dist/esm/TiledObject.d.ts +32 -0
  9. package/dist/esm/TiledObject.js +54 -0
  10. package/dist/esm/TiledObject.js.map +1 -0
  11. package/dist/esm/TiledTileset.d.ts +59 -0
  12. package/dist/esm/TiledTileset.js +70 -0
  13. package/dist/esm/TiledTileset.js.map +1 -0
  14. package/dist/esm/data.d.ts +217 -0
  15. package/dist/esm/gid.d.ts +13 -0
  16. package/dist/esm/gid.js +28 -0
  17. package/dist/esm/gid.js.map +1 -0
  18. package/dist/esm/index.js +8 -1
  19. package/dist/esm/index.js.map +1 -1
  20. package/dist/esm/loadTiledMap.d.ts +9 -0
  21. package/dist/esm/loadTiledMap.js +68 -0
  22. package/dist/esm/loadTiledMap.js.map +1 -0
  23. package/dist/esm/public.d.ts +42 -3
  24. package/dist/esm/register.js +7 -0
  25. package/dist/esm/register.js.map +1 -1
  26. package/dist/esm/tiledBuildInfo.js +2 -2
  27. package/dist/esm/tiledExtension.d.ts +10 -0
  28. package/dist/esm/tiledExtension.js +19 -48
  29. package/dist/esm/tiledExtension.js.map +1 -1
  30. package/dist/esm/tiledMapBinding.d.ts +19 -0
  31. package/dist/esm/tiledMapBinding.js +31 -0
  32. package/dist/esm/tiledMapBinding.js.map +1 -0
  33. package/dist/esm/tiledOptions.d.ts +31 -0
  34. package/dist/esm/tiledOptions.js +16 -0
  35. package/dist/esm/tiledOptions.js.map +1 -0
  36. package/dist/esm/tiledRuntimeMapBinding.d.ts +29 -0
  37. package/dist/esm/tiledRuntimeMapBinding.js +42 -0
  38. package/dist/esm/tiledRuntimeMapBinding.js.map +1 -0
  39. package/dist/esm/url.d.ts +18 -0
  40. package/dist/esm/url.js +41 -0
  41. package/dist/esm/url.js.map +1 -0
  42. package/dist/esm/validate.d.ts +49 -0
  43. package/dist/esm/validate.js +511 -0
  44. package/dist/esm/validate.js.map +1 -0
  45. package/package.json +11 -3
@@ -1,50 +1,389 @@
1
- // ---------------------------------------------------------------------------
2
- // TiledMap runtime object
3
- // ---------------------------------------------------------------------------
1
+ import { TextureRegion } from '@codexo/exojs';
2
+ import { TileSet, TileMap, TileLayer, ObjectLayer } from '@codexo/exojs-tilemap';
3
+ import { maskTiledGid, TILED_FLIPPED_DIAGONALLY_FLAG, TILED_FLIPPED_VERTICALLY_FLAG, TILED_FLIPPED_HORIZONTALLY_FLAG } from './gid.js';
4
+ import { createTiledLayer, TiledGroupLayer, TiledTileLayer, TiledObjectLayer } from './TiledLayer.js';
5
+ import { TiledFormatError } from './validate.js';
6
+
4
7
  /**
5
- * Runtime representation of a loaded Tiled map.
8
+ * A parsed and validated Tiled map (`.tmj`).
6
9
  *
7
- * Exposes map metadata, layers, and tileset textures. Tileset textures
8
- * are owned by the Loader cache `TiledMap.destroy()` does NOT destroy them.
10
+ * `TiledMap` represents the parsed Tiled source format. `TileMap` is the
11
+ * format-independent ExoJS runtime map used for rendering, queries, and
12
+ * mutation.
9
13
  *
10
- * Only the initial proof scope is implemented: orthogonal tile layers,
11
- * basic tilesets, and basic object layers. TMX/XML, infinite maps, and
12
- * world streaming are not supported.
14
+ * Construction validates that {@link tilesets} cover a non-overlapping,
15
+ * duplicate-free range of global tile ids, and that every GID referenced by
16
+ * {@link layers} (tile layer cells, infinite-map chunks, and tile object
17
+ * `gid`s) falls within one of those ranges. Both checks throw
18
+ * {@link TiledFormatError} on failure.
13
19
  */
14
20
  class TiledMap {
21
+ /** Resolved URL this map was loaded from. */
22
+ source;
23
+ /** The validated raw map data this instance was built from. */
15
24
  data;
16
- tilesetTextures;
25
+ orientation;
26
+ renderOrder;
27
+ class;
28
+ /** Map width in tiles. */
17
29
  width;
30
+ /** Map height in tiles. */
18
31
  height;
32
+ /** Tile grid cell width in pixels. */
19
33
  tileWidth;
34
+ /** Tile grid cell height in pixels. */
20
35
  tileHeight;
36
+ infinite;
37
+ backgroundColor;
21
38
  layers;
39
+ /** Tilesets used by this map, sorted by {@link TiledTileset.firstGid} ascending. */
22
40
  tilesets;
23
- constructor(data, tilesetTextures) {
41
+ properties;
42
+ constructor(source, data, tilesets) {
43
+ this.source = source;
24
44
  this.data = data;
25
- this.tilesetTextures = tilesetTextures;
45
+ this.orientation = data.orientation;
46
+ this.renderOrder = data.renderorder;
47
+ this.class = data.class ?? '';
26
48
  this.width = data.width;
27
49
  this.height = data.height;
28
50
  this.tileWidth = data.tilewidth;
29
51
  this.tileHeight = data.tileheight;
30
- this.layers = data.layers;
31
- this.tilesets = data.tilesets;
52
+ this.infinite = data.infinite;
53
+ this.backgroundColor = data.backgroundcolor;
54
+ this.properties = data.properties ?? [];
55
+ this.layers = data.layers.map(createTiledLayer);
56
+ this.tilesets = sortAndValidateTilesetRanges(tilesets, source);
57
+ checkGidCoverage(this, source);
32
58
  }
33
- /** Tile layers only. */
34
- get tileLayers() {
35
- return this.layers.filter(l => l.type === 'tilelayer');
59
+ /**
60
+ * Returns the tileset that owns `gid`, or `undefined` if `gid` is `0`
61
+ * (the empty-cell sentinel) or is not covered by any tileset.
62
+ *
63
+ * Flip/rotation flag bits are masked off before the range lookup, so the
64
+ * raw GID values found in {@link TiledTileLayer.data}/`chunks` and
65
+ * {@link TiledObject.gid} can be passed directly.
66
+ */
67
+ findTilesetForGid(gid) {
68
+ const id = maskTiledGid(gid);
69
+ if (id === 0) {
70
+ return undefined;
71
+ }
72
+ for (const tileset of this.tilesets) {
73
+ if (id >= tileset.firstGid && id <= tileset.lastGid) {
74
+ return tileset;
75
+ }
76
+ }
77
+ return undefined;
36
78
  }
37
- /** Object group layers only. */
38
- get objectLayers() {
39
- return this.layers.filter(l => l.type === 'objectgroup');
79
+ /** Looks up a custom property by name. */
80
+ getProperty(name) {
81
+ return this.properties.find(property => property.name === name);
40
82
  }
41
83
  /**
42
- * Destroy this TiledMap. Does NOT destroy tileset textures they are
43
- * owned by the Loader's cache and may be shared with other callers.
84
+ * Convert this parsed Tiled source model into a format-independent runtime
85
+ * {@link TileMap} from `@codexo/exojs-tilemap`.
86
+ *
87
+ * Only finite orthogonal maps with atlas tilesets are supported. A
88
+ * non-orthogonal or infinite map, or a collection-of-images tileset, throws
89
+ * {@link TiledFormatError} rather than silently producing wrong (misplaced)
90
+ * or empty geometry. Tile layers become renderable `TileLayer`s and object
91
+ * groups become data-only `ObjectLayer`s; group layer children are flattened
92
+ * in document order. Image layers are not yet converted.
93
+ *
94
+ * The returned `TileMap` does **not** own the tileset textures — they remain
95
+ * in the Loader cache. Destroying the returned map does not unload textures.
96
+ */
97
+ toTileMap() {
98
+ // The runtime TileMap is finite + orthogonal in this release. Reject maps
99
+ // we cannot convert faithfully rather than silently producing misplaced
100
+ // (isometric/staggered/hexagonal) or empty (infinite/chunked) geometry.
101
+ if (this.orientation !== 'orthogonal') {
102
+ throw new TiledFormatError(this.source, 'orientation', `toTileMap() supports only orthogonal maps in this release, got "${this.orientation}"`);
103
+ }
104
+ if (this.infinite) {
105
+ throw new TiledFormatError(this.source, 'infinite', 'toTileMap() supports only finite maps in this release; infinite (chunked) maps are not yet convertible');
106
+ }
107
+ // Build runtime tilesets. Tilesets with a per-tile image collection are
108
+ // not yet supported; collection-of-images tilesets throw TiledFormatError.
109
+ // Tilesets with no image at all (no texture, no tileTextures) are silently
110
+ // skipped — their cells appear as empty in the runtime layer.
111
+ const runtimeTilesets = [];
112
+ // indexToRuntime[i] = runtime TileSet for tilesets[i], or null if skipped.
113
+ const indexToRuntime = [];
114
+ for (let i = 0; i < this.tilesets.length; i++) {
115
+ const tiledTs = this.tilesets[i];
116
+ if (!tiledTs) {
117
+ indexToRuntime.push(null);
118
+ continue;
119
+ }
120
+ if (!tiledTs.texture) {
121
+ if (tiledTs.tileTextures.size > 0) {
122
+ throw new TiledFormatError(this.source, `tilesets/${tiledTs.name}`, `tileset "${tiledTs.name}" is a collection-of-images tileset; ` +
123
+ `toTileMap() requires atlas tilesets in this release`);
124
+ }
125
+ // No atlas image and no per-tile images → skip; cells become empty.
126
+ indexToRuntime.push(null);
127
+ continue;
128
+ }
129
+ const tw = tiledTs.imageWidth ?? tiledTs.texture.width;
130
+ const th = tiledTs.imageHeight ?? tiledTs.texture.height;
131
+ const region = new TextureRegion(tiledTs.texture, { x: 0, y: 0, width: tw, height: th });
132
+ const rts = new TileSet({
133
+ name: tiledTs.name,
134
+ texture: region,
135
+ tileWidth: tiledTs.tileWidth,
136
+ tileHeight: tiledTs.tileHeight,
137
+ tileCount: tiledTs.tileCount,
138
+ columns: tiledTs.columns,
139
+ spacing: tiledTs.spacing,
140
+ margin: tiledTs.margin,
141
+ });
142
+ runtimeTilesets.push(rts);
143
+ indexToRuntime.push(rts);
144
+ }
145
+ // Collect and convert tile + object layers, flattening group layers.
146
+ const runtimeLayers = [];
147
+ const runtimeObjectLayers = [];
148
+ const convertLayers = (layers) => {
149
+ for (const layer of layers) {
150
+ if (layer instanceof TiledGroupLayer) {
151
+ convertLayers(layer.layers);
152
+ }
153
+ else if (layer instanceof TiledTileLayer) {
154
+ const rLayer = new TileLayer({
155
+ id: layer.id,
156
+ name: layer.name,
157
+ width: layer.width,
158
+ height: layer.height,
159
+ tilesets: runtimeTilesets,
160
+ tileWidth: this.tileWidth,
161
+ tileHeight: this.tileHeight,
162
+ visible: layer.visible,
163
+ opacity: layer.opacity,
164
+ offsetX: layer.offsetX,
165
+ offsetY: layer.offsetY,
166
+ });
167
+ if (layer.data) {
168
+ populateTileLayer(rLayer, layer.data, this.tilesets, indexToRuntime);
169
+ }
170
+ runtimeLayers.push(rLayer);
171
+ }
172
+ else if (layer instanceof TiledObjectLayer) {
173
+ runtimeObjectLayers.push(convertObjectLayer(layer, this.tilesets, indexToRuntime));
174
+ }
175
+ // ImageLayer: not yet converted.
176
+ }
177
+ };
178
+ convertLayers(this.layers);
179
+ return new TileMap({
180
+ name: this.source,
181
+ width: this.width,
182
+ height: this.height,
183
+ tileWidth: this.tileWidth,
184
+ tileHeight: this.tileHeight,
185
+ tilesets: runtimeTilesets,
186
+ layers: runtimeLayers,
187
+ objectLayers: runtimeObjectLayers,
188
+ });
189
+ }
190
+ /**
191
+ * Releases this map's reference to its parsed source. Tileset textures are
192
+ * Loader-owned and may be shared with other maps; this does NOT destroy
193
+ * them.
44
194
  */
45
195
  destroy() {
46
- // Intentionally empty: tileset textures are Loader-owned.
196
+ // Intentionally empty: all sub-resources (textures) are Loader-owned.
197
+ }
198
+ }
199
+ /**
200
+ * Resolve a raw (flag-bearing) Tiled GID to a runtime {@link ResolvedTile}, or
201
+ * `null` for an empty cell or a GID whose tileset was skipped (no atlas image).
202
+ */
203
+ function resolveGid(rawGid, tiledTilesets, indexToRuntime) {
204
+ if (rawGid === 0)
205
+ return null;
206
+ const baseGid = maskTiledGid(rawGid);
207
+ const transform = {
208
+ flipX: (rawGid >>> 0 & TILED_FLIPPED_HORIZONTALLY_FLAG) !== 0,
209
+ flipY: (rawGid >>> 0 & TILED_FLIPPED_VERTICALLY_FLAG) !== 0,
210
+ diagonal: (rawGid >>> 0 & TILED_FLIPPED_DIAGONALLY_FLAG) !== 0,
211
+ };
212
+ // Find owning tileset: rightmost with firstGid <= baseGid (tilesets sorted asc).
213
+ let tsIdx = -1;
214
+ for (let t = tiledTilesets.length - 1; t >= 0; t--) {
215
+ const candidate = tiledTilesets[t];
216
+ if (candidate && baseGid >= candidate.firstGid) {
217
+ tsIdx = t;
218
+ break;
219
+ }
220
+ }
221
+ if (tsIdx === -1)
222
+ return null;
223
+ const owningTs = tiledTilesets[tsIdx];
224
+ const runtimeTs = indexToRuntime[tsIdx];
225
+ if (!owningTs || !runtimeTs)
226
+ return null; // tileset was skipped (no atlas image)
227
+ return {
228
+ tileset: runtimeTs,
229
+ localTileId: baseGid - owningTs.firstGid,
230
+ transform,
231
+ };
232
+ }
233
+ /** Fill a `TileLayer` from a flat GID array decoded from a Tiled tile layer. */
234
+ function populateTileLayer(layer, gids, tiledTilesets, indexToRuntime) {
235
+ for (let i = 0; i < gids.length; i++) {
236
+ const gid = gids[i];
237
+ if (gid === undefined)
238
+ continue;
239
+ const tile = resolveGid(gid, tiledTilesets, indexToRuntime);
240
+ if (!tile)
241
+ continue;
242
+ layer.setTileAt(i % layer.width, Math.floor(i / layer.width), tile);
243
+ }
244
+ }
245
+ /** Convert a parsed `TiledObjectLayer` into a runtime data-only `ObjectLayer`. */
246
+ function convertObjectLayer(layer, tiledTilesets, indexToRuntime) {
247
+ const objects = [];
248
+ for (const object of layer.objects) {
249
+ const converted = convertObject(object, tiledTilesets, indexToRuntime);
250
+ if (converted)
251
+ objects.push(converted);
252
+ }
253
+ return new ObjectLayer({
254
+ id: layer.id,
255
+ name: layer.name,
256
+ class: layer.class,
257
+ visible: layer.visible,
258
+ opacity: layer.opacity,
259
+ offsetX: layer.offsetX,
260
+ offsetY: layer.offsetY,
261
+ objects,
262
+ properties: convertProperties(layer.properties),
263
+ });
264
+ }
265
+ /**
266
+ * Convert one `TiledObject` to a `TileMapObject`. Text objects (and tile
267
+ * objects whose tileset was skipped) are dropped — returns `null`.
268
+ */
269
+ function convertObject(object, tiledTilesets, indexToRuntime) {
270
+ if (object.text) {
271
+ return null; // text objects are not represented in the data-only model
272
+ }
273
+ const base = {
274
+ id: object.id,
275
+ name: object.name,
276
+ type: object.type,
277
+ x: object.x,
278
+ y: object.y,
279
+ width: object.width,
280
+ height: object.height,
281
+ rotation: object.rotation,
282
+ visible: object.visible,
283
+ properties: convertProperties(object.properties),
284
+ };
285
+ if (object.gid !== undefined) {
286
+ const tile = resolveGid(object.gid, tiledTilesets, indexToRuntime);
287
+ if (!tile)
288
+ return null;
289
+ return { ...base, kind: 'tile', tile };
290
+ }
291
+ if (object.point) {
292
+ return { ...base, kind: 'point' };
293
+ }
294
+ if (object.ellipse) {
295
+ return { ...base, kind: 'ellipse' };
296
+ }
297
+ if (object.polygon) {
298
+ return { ...base, kind: 'polygon', points: toPoints(object.polygon) };
47
299
  }
300
+ if (object.polyline) {
301
+ return { ...base, kind: 'polyline', points: toPoints(object.polyline) };
302
+ }
303
+ return { ...base, kind: 'rectangle' };
304
+ }
305
+ const toPoints = (points) => points.map(p => ({ x: p.x, y: p.y }));
306
+ /**
307
+ * Project Tiled custom properties to the generic flat property bag. Class /
308
+ * object-valued properties are not representable and are skipped.
309
+ */
310
+ function convertProperties(properties) {
311
+ if (properties.length === 0)
312
+ return Object.freeze({});
313
+ const out = {};
314
+ for (const property of properties) {
315
+ const value = property.value;
316
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
317
+ out[property.name] = value;
318
+ }
319
+ }
320
+ return Object.freeze(out);
321
+ }
322
+ function sortAndValidateTilesetRanges(tilesets, source) {
323
+ const sorted = [...tilesets].sort((a, b) => a.firstGid - b.firstGid);
324
+ for (let i = 1; i < sorted.length; i++) {
325
+ const previous = sorted[i - 1];
326
+ const current = sorted[i];
327
+ if (previous === undefined || current === undefined)
328
+ continue;
329
+ if (current.firstGid === previous.firstGid) {
330
+ throw new TiledFormatError(source, 'tilesets', `duplicate firstgid ${current.firstGid} (tilesets "${previous.name}" and "${current.name}")`);
331
+ }
332
+ if (current.firstGid <= previous.lastGid) {
333
+ throw new TiledFormatError(source, 'tilesets', `tileset "${current.name}" (firstgid ${current.firstGid}) overlaps tileset "${previous.name}" (firstgid ${previous.firstGid}, last gid ${previous.lastGid})`);
334
+ }
335
+ }
336
+ return sorted;
337
+ }
338
+ function walkLayers(layers, path, visit) {
339
+ for (let i = 0; i < layers.length; i++) {
340
+ const layer = layers[i];
341
+ if (layer === undefined)
342
+ continue;
343
+ const layerPath = `${path}[${i}]`;
344
+ visit(layer, layerPath);
345
+ if (layer instanceof TiledGroupLayer) {
346
+ walkLayers(layer.layers, `${layerPath}.layers`, visit);
347
+ }
348
+ }
349
+ }
350
+ function checkGidArray(gids, map, source, path) {
351
+ for (let i = 0; i < gids.length; i++) {
352
+ const gid = gids[i];
353
+ if (gid === undefined)
354
+ continue;
355
+ if (gid !== 0 && map.findTilesetForGid(gid) === undefined) {
356
+ throw new TiledFormatError(source, `${path}[${i}]`, `gid ${gid} (masked: ${maskTiledGid(gid)}) is not covered by any tileset`);
357
+ }
358
+ }
359
+ }
360
+ function checkGidCoverage(map, source) {
361
+ walkLayers(map.layers, 'layers', (layer, layerPath) => {
362
+ if (layer instanceof TiledTileLayer) {
363
+ if (layer.data !== undefined) {
364
+ checkGidArray(layer.data, map, source, `${layerPath}.data`);
365
+ }
366
+ if (layer.chunks !== undefined) {
367
+ for (let c = 0; c < layer.chunks.length; c++) {
368
+ const chunk = layer.chunks[c];
369
+ if (chunk === undefined)
370
+ continue;
371
+ checkGidArray(chunk.data, map, source, `${layerPath}.chunks[${c}].data`);
372
+ }
373
+ }
374
+ }
375
+ else if (layer instanceof TiledObjectLayer) {
376
+ for (let o = 0; o < layer.objects.length; o++) {
377
+ const object = layer.objects[o];
378
+ if (object === undefined)
379
+ continue;
380
+ const gid = object.gid;
381
+ if (gid !== undefined && map.findTilesetForGid(gid) === undefined) {
382
+ throw new TiledFormatError(source, `${layerPath}.objects[${o}].gid`, `gid ${gid} (masked: ${maskTiledGid(gid)}) is not covered by any tileset`);
383
+ }
384
+ }
385
+ }
386
+ });
48
387
  }
49
388
 
50
389
  export { TiledMap };
@@ -1 +1 @@
1
- {"version":3,"file":"TiledMap.js","sources":["../../../src/TiledMap.ts"],"sourcesContent":[null],"names":[],"mappings":"AAoEA;AACA;AACA;AAEA;;;;;;;;;AASG;MACU,QAAQ,CAAA;AACH,IAAA,IAAI;AACJ,IAAA,eAAe;AAEf,IAAA,KAAK;AACL,IAAA,MAAM;AACN,IAAA,SAAS;AACT,IAAA,UAAU;AAEV,I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G,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA,QAAA,EAAW,CAAC,CAAA,MAAA,CAAQ,CAAC;gBAC1E;YACF;QACF;AAAO,aAAA,IAAI,KAAK,YAAY,gBAAgB,EAAE;AAC5C,YAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC7C,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC/B,IAAI,MAAM,KAAK,SAAS;oBAAE;AAC1B,gBAAA,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG;AAEtB,gBAAA,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;oBACjE,MAAM,IAAI,gBAAgB,CAAC,MAAM,EAAE,CAAA,EAAG,SAAS,YAAY,CAAC,CAAA,KAAA,CAAO,EAAE,CAAA,IAAA,EAAO,GAAG,aAAa,YAAY,CAAC,GAAG,CAAC,CAAA,+BAAA,CAAiC,CAAC;gBACjJ;YACF;QACF;AACF,IAAA,CAAC,CAAC;AACJ;;;;"}
@@ -0,0 +1,32 @@
1
+ import type { TiledObjectData, TiledPointData, TiledPropertyData, TiledTextData } from './data';
2
+ /**
3
+ * A parsed Tiled object, placed in an {@link TiledObjectLayer} or a tile's
4
+ * collision `objectgroup`.
5
+ *
6
+ * The shape of the object is determined by which of {@link point},
7
+ * {@link ellipse}, {@link polygon}, {@link polyline}, {@link text}, or
8
+ * {@link gid} is set; if none are set, the object is a plain rectangle
9
+ * spanning `[x, y, width, height]`.
10
+ */
11
+ export declare class TiledObject {
12
+ readonly id: number;
13
+ readonly name: string;
14
+ readonly type: string;
15
+ readonly x: number;
16
+ readonly y: number;
17
+ readonly width: number;
18
+ readonly height: number;
19
+ readonly rotation: number;
20
+ readonly visible: boolean;
21
+ readonly gid?: number | undefined;
22
+ readonly point: boolean;
23
+ readonly ellipse: boolean;
24
+ readonly polygon?: readonly TiledPointData[] | undefined;
25
+ readonly polyline?: readonly TiledPointData[] | undefined;
26
+ readonly text?: TiledTextData | undefined;
27
+ readonly template?: string | undefined;
28
+ readonly properties: readonly TiledPropertyData[];
29
+ constructor(data: TiledObjectData);
30
+ /** Looks up a custom property by name. */
31
+ getProperty(name: string): TiledPropertyData | undefined;
32
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * A parsed Tiled object, placed in an {@link TiledObjectLayer} or a tile's
3
+ * collision `objectgroup`.
4
+ *
5
+ * The shape of the object is determined by which of {@link point},
6
+ * {@link ellipse}, {@link polygon}, {@link polyline}, {@link text}, or
7
+ * {@link gid} is set; if none are set, the object is a plain rectangle
8
+ * spanning `[x, y, width, height]`.
9
+ */
10
+ class TiledObject {
11
+ id;
12
+ name;
13
+ type;
14
+ x;
15
+ y;
16
+ width;
17
+ height;
18
+ rotation;
19
+ visible;
20
+ gid;
21
+ point;
22
+ ellipse;
23
+ polygon;
24
+ polyline;
25
+ text;
26
+ template;
27
+ properties;
28
+ constructor(data) {
29
+ this.id = data.id;
30
+ this.name = data.name;
31
+ this.type = data.type;
32
+ this.x = data.x;
33
+ this.y = data.y;
34
+ this.width = data.width;
35
+ this.height = data.height;
36
+ this.rotation = data.rotation;
37
+ this.visible = data.visible;
38
+ this.gid = data.gid;
39
+ this.point = data.point ?? false;
40
+ this.ellipse = data.ellipse ?? false;
41
+ this.polygon = data.polygon;
42
+ this.polyline = data.polyline;
43
+ this.text = data.text;
44
+ this.template = data.template;
45
+ this.properties = data.properties ?? [];
46
+ }
47
+ /** Looks up a custom property by name. */
48
+ getProperty(name) {
49
+ return this.properties.find(property => property.name === name);
50
+ }
51
+ }
52
+
53
+ export { TiledObject };
54
+ //# sourceMappingURL=TiledObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TiledObject.js","sources":["../../../src/TiledObject.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;;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,CAAC,QAAQ;QAC7B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE;IACzC;;AAGO,IAAA,WAAW,CAAC,IAAY,EAAA;AAC7B,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC;IACjE;AACD;;;;"}
@@ -0,0 +1,59 @@
1
+ import type { Texture } from '@codexo/exojs';
2
+ import type { TiledPointData, TiledPropertyData, TiledTileData, TiledTilesetData } from './data';
3
+ /**
4
+ * Loader-resolved resources for a {@link TiledTileset}: the absolute image
5
+ * URL(s) and the {@link Texture} instance(s) loaded for them. All textures
6
+ * are owned by the `Loader` cache — a {@link TiledTileset} never destroys
7
+ * them.
8
+ */
9
+ export interface TiledTilesetResources {
10
+ /** Resolved URL of the external `.tsj` file, or `undefined` for an embedded tileset. */
11
+ readonly source?: string | undefined;
12
+ /** Resolved URL of the tileset's atlas {@link TiledTilesetData.image}, or `undefined` for a collection-of-images tileset. */
13
+ readonly imageUrl?: string | undefined;
14
+ /** Texture loaded for {@link imageUrl}. */
15
+ readonly texture?: Texture | undefined;
16
+ /** Textures loaded for collection-of-images {@link TiledTileData.image} entries, keyed by local tile id. */
17
+ readonly tileTextures?: ReadonlyMap<number, Texture> | undefined;
18
+ }
19
+ /**
20
+ * A parsed Tiled tileset — either embedded inline in a map's `tilesets`
21
+ * array, or parsed from an external `.tsj` file referenced by it.
22
+ *
23
+ * {@link firstGid} and {@link lastGid} define the inclusive range of global
24
+ * tile ids (after masking flip/rotation flags via `maskTiledGid`) that this
25
+ * tileset owns within its owning {@link TiledMap}.
26
+ */
27
+ export declare class TiledTileset {
28
+ /** First global tile id owned by this tileset. */
29
+ readonly firstGid: number;
30
+ /** Resolved URL of the external `.tsj` file, or `undefined` for an embedded tileset. */
31
+ readonly source?: string | undefined;
32
+ readonly name: string;
33
+ readonly class: string;
34
+ readonly tileWidth: number;
35
+ readonly tileHeight: number;
36
+ readonly tileCount: number;
37
+ readonly columns: number;
38
+ readonly spacing: number;
39
+ readonly margin: number;
40
+ /** Resolved URL of the tileset's atlas image, or `undefined` for a collection-of-images tileset. */
41
+ readonly imageUrl?: string | undefined;
42
+ readonly imageWidth?: number | undefined;
43
+ readonly imageHeight?: number | undefined;
44
+ /** Texture loaded for {@link imageUrl}. Loader-owned; not destroyed by {@link TiledMap.destroy}. */
45
+ readonly texture?: Texture | undefined;
46
+ readonly tileOffset: TiledPointData;
47
+ readonly objectAlignment?: string | undefined;
48
+ readonly tiles: readonly TiledTileData[];
49
+ /** Textures loaded for collection-of-images tiles, keyed by local tile id. Loader-owned. */
50
+ readonly tileTextures: ReadonlyMap<number, Texture>;
51
+ readonly properties: readonly TiledPropertyData[];
52
+ constructor(data: TiledTilesetData, firstGid: number, resources?: TiledTilesetResources);
53
+ /** Last global tile id (inclusive) owned by this tileset. Empty (`lastGid < firstGid`) when {@link tileCount} is `0`. */
54
+ get lastGid(): number;
55
+ /** Looks up a per-tile definition by local tile id. */
56
+ getTile(localId: number): TiledTileData | undefined;
57
+ /** Looks up a custom property by name. */
58
+ getProperty(name: string): TiledPropertyData | undefined;
59
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * A parsed Tiled tileset — either embedded inline in a map's `tilesets`
3
+ * array, or parsed from an external `.tsj` file referenced by it.
4
+ *
5
+ * {@link firstGid} and {@link lastGid} define the inclusive range of global
6
+ * tile ids (after masking flip/rotation flags via `maskTiledGid`) that this
7
+ * tileset owns within its owning {@link TiledMap}.
8
+ */
9
+ class TiledTileset {
10
+ /** First global tile id owned by this tileset. */
11
+ firstGid;
12
+ /** Resolved URL of the external `.tsj` file, or `undefined` for an embedded tileset. */
13
+ source;
14
+ name;
15
+ class;
16
+ tileWidth;
17
+ tileHeight;
18
+ tileCount;
19
+ columns;
20
+ spacing;
21
+ margin;
22
+ /** Resolved URL of the tileset's atlas image, or `undefined` for a collection-of-images tileset. */
23
+ imageUrl;
24
+ imageWidth;
25
+ imageHeight;
26
+ /** Texture loaded for {@link imageUrl}. Loader-owned; not destroyed by {@link TiledMap.destroy}. */
27
+ texture;
28
+ tileOffset;
29
+ objectAlignment;
30
+ tiles;
31
+ /** Textures loaded for collection-of-images tiles, keyed by local tile id. Loader-owned. */
32
+ tileTextures;
33
+ properties;
34
+ constructor(data, firstGid, resources = {}) {
35
+ this.firstGid = firstGid;
36
+ this.source = resources.source;
37
+ this.name = data.name;
38
+ this.class = data.class ?? '';
39
+ this.tileWidth = data.tilewidth;
40
+ this.tileHeight = data.tileheight;
41
+ this.tileCount = data.tilecount;
42
+ this.columns = data.columns;
43
+ this.spacing = data.spacing ?? 0;
44
+ this.margin = data.margin ?? 0;
45
+ this.imageUrl = resources.imageUrl;
46
+ this.imageWidth = data.imagewidth;
47
+ this.imageHeight = data.imageheight;
48
+ this.texture = resources.texture;
49
+ this.tileOffset = data.tileoffset ?? { x: 0, y: 0 };
50
+ this.objectAlignment = data.objectalignment;
51
+ this.tiles = data.tiles ?? [];
52
+ this.tileTextures = resources.tileTextures ?? new Map();
53
+ this.properties = data.properties ?? [];
54
+ }
55
+ /** Last global tile id (inclusive) owned by this tileset. Empty (`lastGid < firstGid`) when {@link tileCount} is `0`. */
56
+ get lastGid() {
57
+ return this.firstGid + this.tileCount - 1;
58
+ }
59
+ /** Looks up a per-tile definition by local tile id. */
60
+ getTile(localId) {
61
+ return this.tiles.find(tile => tile.id === localId);
62
+ }
63
+ /** Looks up a custom property by name. */
64
+ getProperty(name) {
65
+ return this.properties.find(property => property.name === name);
66
+ }
67
+ }
68
+
69
+ export { TiledTileset };
70
+ //# sourceMappingURL=TiledTileset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TiledTileset.js","sources":["../../../src/TiledTileset.ts"],"sourcesContent":[null],"names":[],"mappings":"AAqBA;;;;;;;AAOG;MACU,YAAY,CAAA;;AAEP,IAAA,QAAQ;;AAER,IAAA,MAAM;AACN,IAAA,IAAI;AACJ,IAAA,KA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