Skip to content

parseTexturePackerAtlas

parseTexturePackerAtlas(xml): ParsedAtlas

Defined in: src/modules/texture-atlas/texture-atlas.ts:66

Parses a TexturePacker / Kenney “Generic XML” sprite-atlas document.

Expected shape (Kenney space packs, TexturePacker “Generic XML”):

<TextureAtlas imagePath="sheet.png">
<SubTexture name="enemy_A.png" x="400" y="256" width="96" height="96"/>
</TextureAtlas>

Pure and DOM-free (regex-based) so it runs in any environment. Rotated or trimmed frames are not supported — a rotated="true" attribute throws rather than mis-rendering.

string

Raw atlas XML document text.

ParsedAtlas

The image path and a frame-name → source-rect map.