Skip to content

buildTilemapAtlas

buildTilemapAtlas(opts): TextureAtlasRegistry

Defined in: src/modules/tilemap/atlas.ts:29

Collects every unique GID across all visible tile layers, resolves each to its source rectangle via gidToFrame, and registers the frames under name in a new TextureAtlasRegistry.

The returned registry is ready to hand to Canvas2DRenderContext.atlases. Callers that load multiple maps or layer additional atlases on top can call registry.add(...) on the result before passing it to the renderer.

The atlas is built synchronously — the image must already be loaded. Throws when the map has no tileset.

BuildTilemapAtlasOptions

TextureAtlasRegistry