@flighthq/textureatlas-formats 0.1.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.
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/textureAtlasAsepriteParse.d.ts +5 -0
- package/dist/textureAtlasAsepriteParse.d.ts.map +1 -0
- package/dist/textureAtlasAsepriteParse.js +42 -0
- package/dist/textureAtlasAsepriteParse.js.map +1 -0
- package/dist/textureAtlasAsepriteSchema.d.ts +53 -0
- package/dist/textureAtlasAsepriteSchema.d.ts.map +1 -0
- package/dist/textureAtlasAsepriteSchema.js +6 -0
- package/dist/textureAtlasAsepriteSchema.js.map +1 -0
- package/dist/textureAtlasDetect.d.ts +16 -0
- package/dist/textureAtlasDetect.d.ts.map +1 -0
- package/dist/textureAtlasDetect.js +71 -0
- package/dist/textureAtlasDetect.js.map +1 -0
- package/dist/textureAtlasLibgdxParse.d.ts +3 -0
- package/dist/textureAtlasLibgdxParse.d.ts.map +1 -0
- package/dist/textureAtlasLibgdxParse.js +114 -0
- package/dist/textureAtlasLibgdxParse.js.map +1 -0
- package/dist/textureAtlasPackerParse.d.ts +9 -0
- package/dist/textureAtlasPackerParse.d.ts.map +1 -0
- package/dist/textureAtlasPackerParse.js +57 -0
- package/dist/textureAtlasPackerParse.js.map +1 -0
- package/dist/textureAtlasPackerSchema.d.ts +52 -0
- package/dist/textureAtlasPackerSchema.d.ts.map +1 -0
- package/dist/textureAtlasPackerSchema.js +5 -0
- package/dist/textureAtlasPackerSchema.js.map +1 -0
- package/dist/textureAtlasStarlingParse.d.ts +14 -0
- package/dist/textureAtlasStarlingParse.d.ts.map +1 -0
- package/dist/textureAtlasStarlingParse.js +50 -0
- package/dist/textureAtlasStarlingParse.js.map +1 -0
- package/package.json +39 -0
- package/src/textureAtlasAsepriteParse.test.ts +131 -0
- package/src/textureAtlasDetect.test.ts +98 -0
- package/src/textureAtlasLibgdxParse.test.ts +114 -0
- package/src/textureAtlasPackerParse.test.ts +206 -0
- package/src/textureAtlasStarlingParse.test.ts +92 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './textureAtlasAsepriteParse';
|
|
2
|
+
export * from './textureAtlasAsepriteSchema';
|
|
3
|
+
export * from './textureAtlasDetect';
|
|
4
|
+
export * from './textureAtlasLibgdxParse';
|
|
5
|
+
export * from './textureAtlasPackerParse';
|
|
6
|
+
export * from './textureAtlasPackerSchema';
|
|
7
|
+
export * from './textureAtlasStarlingParse';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './textureAtlasAsepriteParse';
|
|
2
|
+
export * from './textureAtlasAsepriteSchema';
|
|
3
|
+
export * from './textureAtlasDetect';
|
|
4
|
+
export * from './textureAtlasLibgdxParse';
|
|
5
|
+
export * from './textureAtlasPackerParse';
|
|
6
|
+
export * from './textureAtlasPackerSchema';
|
|
7
|
+
export * from './textureAtlasStarlingParse';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TextureAtlas } from '@flighthq/types';
|
|
2
|
+
import type { TextureAtlasAsepriteDocument } from './textureAtlasAsepriteSchema';
|
|
3
|
+
export declare function parseTextureAtlasAsepriteDocument(doc: TextureAtlasAsepriteDocument, atlas: TextureAtlas): TextureAtlas;
|
|
4
|
+
export declare function parseTextureAtlasAsepriteJson(json: string, atlas: TextureAtlas): TextureAtlas;
|
|
5
|
+
//# sourceMappingURL=textureAtlasAsepriteParse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textureAtlasAsepriteParse.d.ts","sourceRoot":"","sources":["../src/textureAtlasAsepriteParse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EAGV,4BAA4B,EAC7B,MAAM,8BAA8B,CAAC;AAGtC,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,4BAA4B,EACjC,KAAK,EAAE,YAAY,GAClB,YAAY,CAYd;AAKD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY,CAG7F"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createTextureAtlasRegion } from '@flighthq/textureatlas';
|
|
2
|
+
// Convenience variant that accepts an already-parsed Aseprite document object.
|
|
3
|
+
export function parseTextureAtlasAsepriteDocument(doc, atlas) {
|
|
4
|
+
atlas.regions.length = 0;
|
|
5
|
+
if (Array.isArray(doc.frames)) {
|
|
6
|
+
for (const entry of doc.frames) {
|
|
7
|
+
applyAsepriteFrame(atlas, entry.filename, entry);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
for (const [frameName, entry] of Object.entries(doc.frames)) {
|
|
12
|
+
applyAsepriteFrame(atlas, frameName, entry);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return atlas;
|
|
16
|
+
}
|
|
17
|
+
// Parses an Aseprite JSON string and populates `atlas.regions`.
|
|
18
|
+
// Supports both the JSON-hash and JSON-array frame shapes.
|
|
19
|
+
// Existing regions in `atlas` are cleared. Returns `atlas` for convenience.
|
|
20
|
+
export function parseTextureAtlasAsepriteJson(json, atlas) {
|
|
21
|
+
const doc = JSON.parse(json);
|
|
22
|
+
return parseTextureAtlasAsepriteDocument(doc, atlas);
|
|
23
|
+
}
|
|
24
|
+
function applyAsepriteFrame(atlas, name, entry) {
|
|
25
|
+
atlas.regions.push(createTextureAtlasRegion({
|
|
26
|
+
height: entry.frame.h,
|
|
27
|
+
id: atlas.regions.length,
|
|
28
|
+
name,
|
|
29
|
+
originalHeight: entry.trimmed ? entry.sourceSize.h : null,
|
|
30
|
+
originalWidth: entry.trimmed ? entry.sourceSize.w : null,
|
|
31
|
+
pivotX: null,
|
|
32
|
+
pivotY: null,
|
|
33
|
+
rotated: entry.rotated,
|
|
34
|
+
sourceX: entry.spriteSourceSize.x,
|
|
35
|
+
sourceY: entry.spriteSourceSize.y,
|
|
36
|
+
trimmed: entry.trimmed,
|
|
37
|
+
width: entry.frame.w,
|
|
38
|
+
x: entry.frame.x,
|
|
39
|
+
y: entry.frame.y,
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=textureAtlasAsepriteParse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textureAtlasAsepriteParse.js","sourceRoot":"","sources":["../src/textureAtlasAsepriteParse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AASlE,+EAA+E;AAC/E,MAAM,UAAU,iCAAiC,CAC/C,GAAiC,EACjC,KAAmB;IAEnB,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IACzB,IAAI,KAAK,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EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACjC,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACjC,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;KACjB,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface TextureAtlasAsepriteRect {
|
|
2
|
+
h: number;
|
|
3
|
+
w: number;
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
export interface TextureAtlasAsepriteSize {
|
|
8
|
+
h: number;
|
|
9
|
+
w: number;
|
|
10
|
+
}
|
|
11
|
+
export interface TextureAtlasAsepriteFrameTag {
|
|
12
|
+
/** Playback direction for this tag range. */
|
|
13
|
+
direction: 'forward' | 'pingpong' | 'pingpong_reverse' | 'reverse';
|
|
14
|
+
/** Index of first frame in this tag (inclusive). */
|
|
15
|
+
from: number;
|
|
16
|
+
name: string;
|
|
17
|
+
/** Index of last frame in this tag (inclusive). */
|
|
18
|
+
to: number;
|
|
19
|
+
/** Optional hex colour label assigned in Aseprite. */
|
|
20
|
+
color?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface TextureAtlasAsepriteBaseFrame {
|
|
23
|
+
/** Per-frame display duration in milliseconds. */
|
|
24
|
+
duration: number;
|
|
25
|
+
frame: TextureAtlasAsepriteRect;
|
|
26
|
+
rotated: boolean;
|
|
27
|
+
sourceSize: TextureAtlasAsepriteSize;
|
|
28
|
+
spriteSourceSize: TextureAtlasAsepriteRect;
|
|
29
|
+
trimmed: boolean;
|
|
30
|
+
}
|
|
31
|
+
export type TextureAtlasAsepriteHashFrame = TextureAtlasAsepriteBaseFrame;
|
|
32
|
+
export interface TextureAtlasAsepriteArrayFrame extends TextureAtlasAsepriteBaseFrame {
|
|
33
|
+
filename: string;
|
|
34
|
+
}
|
|
35
|
+
export interface TextureAtlasAsepriteMeta {
|
|
36
|
+
app: string;
|
|
37
|
+
format: string;
|
|
38
|
+
frameTags?: TextureAtlasAsepriteFrameTag[];
|
|
39
|
+
image: string;
|
|
40
|
+
scale: number | string;
|
|
41
|
+
size: TextureAtlasAsepriteSize;
|
|
42
|
+
version: string;
|
|
43
|
+
}
|
|
44
|
+
export interface TextureAtlasAsepriteHashDocument {
|
|
45
|
+
frames: Record<string, TextureAtlasAsepriteHashFrame>;
|
|
46
|
+
meta: TextureAtlasAsepriteMeta;
|
|
47
|
+
}
|
|
48
|
+
export interface TextureAtlasAsepriteArrayDocument {
|
|
49
|
+
frames: TextureAtlasAsepriteArrayFrame[];
|
|
50
|
+
meta: TextureAtlasAsepriteMeta;
|
|
51
|
+
}
|
|
52
|
+
export type TextureAtlasAsepriteDocument = TextureAtlasAsepriteArrayDocument | TextureAtlasAsepriteHashDocument;
|
|
53
|
+
//# sourceMappingURL=textureAtlasAsepriteSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textureAtlasAsepriteSchema.d.ts","sourceRoot":"","sources":["../src/textureAtlasAsepriteSchema.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,wBAAwB;IACvC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,wBAAwB;IACvC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,4BAA4B;IAC3C,6CAA6C;IAC7C,SAAS,EAAE,SAAS,GAAG,UAAU,GAAG,kBAAkB,GAAG,SAAS,CAAC;IACnE,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,6BAA6B;IAC5C,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,wBAAwB,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,wBAAwB,CAAC;IACrC,gBAAgB,EAAE,wBAAwB,CAAC;IAC3C,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,6BAA6B,GAAG,6BAA6B,CAAC;AAE1E,MAAM,WAAW,8BAA+B,SAAQ,6BAA6B;IACnF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,4BAA4B,EAAE,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;IACtD,IAAI,EAAE,wBAAwB,CAAC;CAChC;AAED,MAAM,WAAW,iCAAiC;IAChD,MAAM,EAAE,8BAA8B,EAAE,CAAC;IACzC,IAAI,EAAE,wBAAwB,CAAC;CAChC;AAED,MAAM,MAAM,4BAA4B,GAAG,iCAAiC,GAAG,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Aseprite JSON export schema — field names as they appear in the exported file.
|
|
2
|
+
// Reference: https://www.aseprite.org/docs/cli/#sheet-json
|
|
3
|
+
// Aseprite exports either a Hash variant (frames is a dict keyed by name) or
|
|
4
|
+
// an Array variant (frames is an array with a filename field per entry).
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=textureAtlasAsepriteSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textureAtlasAsepriteSchema.js","sourceRoot":"","sources":["../src/textureAtlasAsepriteSchema.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,2DAA2D;AAC3D,6EAA6E;AAC7E,yEAAyE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TextureAtlasFormatKind } from '@flighthq/types';
|
|
2
|
+
/** Sniff the text content of a texture-atlas descriptor and return its format kind, or
|
|
3
|
+
* `null` when no supported format is recognisable.
|
|
4
|
+
*
|
|
5
|
+
* Detection is structural, not extension-based, and covers the four formats with parsers:
|
|
6
|
+
* - Starling / Sparrow XML: an XML document whose root (or a child) is `<TextureAtlas`.
|
|
7
|
+
* - libGDX / Spine text: a plain-text page header followed by `size:` / `format:` lines
|
|
8
|
+
* and per-region `xy:` / `orig:` blocks.
|
|
9
|
+
* - Aseprite JSON and TexturePacker JSON share a `{ frames, meta }` shape and are
|
|
10
|
+
* disambiguated by `meta.app` (`aseprite` vs `texturepacker`/`codeandweb`), falling back
|
|
11
|
+
* to the Aseprite-only per-frame `duration` field.
|
|
12
|
+
*
|
|
13
|
+
* Returns `null` for unknown or corrupt input — never throws. This is the texture-atlas
|
|
14
|
+
* counterpart of `detectParticleFormat` in `@flighthq/particles-formats`. */
|
|
15
|
+
export declare function detectTextureAtlasFormat(content: string): TextureAtlasFormatKind | null;
|
|
16
|
+
//# sourceMappingURL=textureAtlasDetect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textureAtlasDetect.d.ts","sourceRoot":"","sources":["../src/textureAtlasDetect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAQ9D;;;;;;;;;;;;8EAY8E;AAC9E,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,sBAAsB,GAAG,IAAI,CA6BvF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { TextureAtlasFormatKindAseprite, TextureAtlasFormatKindLibgdxAtlas, TextureAtlasFormatKindStarling, TextureAtlasFormatKindTexturePacker, } from '@flighthq/types';
|
|
2
|
+
/** Sniff the text content of a texture-atlas descriptor and return its format kind, or
|
|
3
|
+
* `null` when no supported format is recognisable.
|
|
4
|
+
*
|
|
5
|
+
* Detection is structural, not extension-based, and covers the four formats with parsers:
|
|
6
|
+
* - Starling / Sparrow XML: an XML document whose root (or a child) is `<TextureAtlas`.
|
|
7
|
+
* - libGDX / Spine text: a plain-text page header followed by `size:` / `format:` lines
|
|
8
|
+
* and per-region `xy:` / `orig:` blocks.
|
|
9
|
+
* - Aseprite JSON and TexturePacker JSON share a `{ frames, meta }` shape and are
|
|
10
|
+
* disambiguated by `meta.app` (`aseprite` vs `texturepacker`/`codeandweb`), falling back
|
|
11
|
+
* to the Aseprite-only per-frame `duration` field.
|
|
12
|
+
*
|
|
13
|
+
* Returns `null` for unknown or corrupt input — never throws. This is the texture-atlas
|
|
14
|
+
* counterpart of `detectParticleFormat` in `@flighthq/particles-formats`. */
|
|
15
|
+
export function detectTextureAtlasFormat(content) {
|
|
16
|
+
if (typeof content !== 'string')
|
|
17
|
+
return null;
|
|
18
|
+
const trimmed = content.trimStart();
|
|
19
|
+
if (trimmed === '')
|
|
20
|
+
return null;
|
|
21
|
+
if (trimmed.startsWith('<')) {
|
|
22
|
+
return trimmed.includes('<TextureAtlas') ? TextureAtlasFormatKindStarling : null;
|
|
23
|
+
}
|
|
24
|
+
if (trimmed.startsWith('{')) {
|
|
25
|
+
let raw;
|
|
26
|
+
try {
|
|
27
|
+
raw = JSON.parse(content);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
if (raw === null || typeof raw !== 'object' || Array.isArray(raw))
|
|
33
|
+
return null;
|
|
34
|
+
const obj = raw;
|
|
35
|
+
if (obj.frames === undefined)
|
|
36
|
+
return null;
|
|
37
|
+
const app = readMetaApp(obj.meta).toLowerCase();
|
|
38
|
+
if (app.includes('aseprite'))
|
|
39
|
+
return TextureAtlasFormatKindAseprite;
|
|
40
|
+
if (app.includes('texturepacker') || app.includes('codeandweb'))
|
|
41
|
+
return TextureAtlasFormatKindTexturePacker;
|
|
42
|
+
// No recognisable app string — Aseprite frames carry a per-frame `duration`, TexturePacker's do not.
|
|
43
|
+
return hasFrameDuration(obj.frames) ? TextureAtlasFormatKindAseprite : TextureAtlasFormatKindTexturePacker;
|
|
44
|
+
}
|
|
45
|
+
// Plain-text path: libGDX atlas pages open with an image line followed by `key: value`
|
|
46
|
+
// header lines (`size:`, `format:`) and per-region `xy:` / `orig:` blocks.
|
|
47
|
+
if (/^\s*(size|format|filter|repeat)\s*:/m.test(trimmed) && /^\s*(xy|orig)\s*:/m.test(trimmed)) {
|
|
48
|
+
return TextureAtlasFormatKindLibgdxAtlas;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
function firstFrame(frames) {
|
|
53
|
+
if (Array.isArray(frames))
|
|
54
|
+
return frames[0];
|
|
55
|
+
if (frames !== null && typeof frames === 'object') {
|
|
56
|
+
for (const value of Object.values(frames))
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
function hasFrameDuration(frames) {
|
|
62
|
+
const frame = firstFrame(frames);
|
|
63
|
+
return frame !== null && typeof frame === 'object' && typeof frame.duration === 'number';
|
|
64
|
+
}
|
|
65
|
+
function readMetaApp(meta) {
|
|
66
|
+
if (meta === null || typeof meta !== 'object')
|
|
67
|
+
return '';
|
|
68
|
+
const app = meta.app;
|
|
69
|
+
return typeof app === 'string' ? app : '';
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=textureAtlasDetect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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AAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textureAtlasLibgdxParse.d.ts","sourceRoot":"","sources":["../src/textureAtlasLibgdxParse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKpD,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY,CAwG5F"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { createTextureAtlasRegion } from '@flighthq/textureatlas';
|
|
2
|
+
// Parses a libGDX / Spine text-format atlas string and populates `atlas.regions`.
|
|
3
|
+
// Handles single and multi-page atlases; regions from all pages are concatenated.
|
|
4
|
+
// Existing regions in `atlas` are cleared. Returns `atlas` for convenience.
|
|
5
|
+
export function parseTextureAtlasLibgdxAtlas(text, atlas) {
|
|
6
|
+
atlas.regions.length = 0;
|
|
7
|
+
const lines = text.split(/\r?\n/);
|
|
8
|
+
let i = 0;
|
|
9
|
+
let id = 0;
|
|
10
|
+
while (i < lines.length) {
|
|
11
|
+
// Skip blank lines (page separator or leading whitespace)
|
|
12
|
+
while (i < lines.length && lines[i].trim() === '')
|
|
13
|
+
i++;
|
|
14
|
+
if (i >= lines.length)
|
|
15
|
+
break;
|
|
16
|
+
// Page header: first non-blank line is the image file name (no colon)
|
|
17
|
+
const maybeImage = lines[i].trim();
|
|
18
|
+
if (!maybeImage.includes(':')) {
|
|
19
|
+
i++; // consume image filename
|
|
20
|
+
// Skip page-level key:value pairs
|
|
21
|
+
while (i < lines.length && lines[i].trim() !== '') {
|
|
22
|
+
if (lines[i].trim().includes(':'))
|
|
23
|
+
i++;
|
|
24
|
+
else
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Read regions until blank line or EOF
|
|
29
|
+
while (i < lines.length && lines[i].trim() !== '') {
|
|
30
|
+
const line = lines[i].trim();
|
|
31
|
+
// If a line has no colon it is a region name
|
|
32
|
+
if (!line.includes(':')) {
|
|
33
|
+
const regionName = line;
|
|
34
|
+
i++;
|
|
35
|
+
let atlasX = 0;
|
|
36
|
+
let atlasY = 0;
|
|
37
|
+
let atlasW = 0;
|
|
38
|
+
let atlasH = 0;
|
|
39
|
+
let origW = 0;
|
|
40
|
+
let origH = 0;
|
|
41
|
+
let offsetX = 0;
|
|
42
|
+
let offsetY = 0;
|
|
43
|
+
let rotated = false;
|
|
44
|
+
let index = -1;
|
|
45
|
+
// Read region key:value pairs
|
|
46
|
+
while (i < lines.length) {
|
|
47
|
+
const kv = lines[i].trim();
|
|
48
|
+
if (kv === '' || !kv.includes(':'))
|
|
49
|
+
break;
|
|
50
|
+
const colon = kv.indexOf(':');
|
|
51
|
+
const key = kv.slice(0, colon).trim();
|
|
52
|
+
const value = kv.slice(colon + 1).trim();
|
|
53
|
+
i++;
|
|
54
|
+
switch (key) {
|
|
55
|
+
case 'rotate':
|
|
56
|
+
rotated = value === 'true';
|
|
57
|
+
break;
|
|
58
|
+
case 'xy': {
|
|
59
|
+
const parts = value.split(',');
|
|
60
|
+
atlasX = parseFloat(parts[0]?.trim() ?? '0');
|
|
61
|
+
atlasY = parseFloat(parts[1]?.trim() ?? '0');
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case 'size': {
|
|
65
|
+
const parts = value.split(',');
|
|
66
|
+
atlasW = parseFloat(parts[0]?.trim() ?? '0');
|
|
67
|
+
atlasH = parseFloat(parts[1]?.trim() ?? '0');
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
case 'orig': {
|
|
71
|
+
const parts = value.split(',');
|
|
72
|
+
origW = parseFloat(parts[0]?.trim() ?? '0');
|
|
73
|
+
origH = parseFloat(parts[1]?.trim() ?? '0');
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
case 'offset': {
|
|
77
|
+
const parts = value.split(',');
|
|
78
|
+
offsetX = parseFloat(parts[0]?.trim() ?? '0');
|
|
79
|
+
offsetY = parseFloat(parts[1]?.trim() ?? '0');
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case 'index':
|
|
83
|
+
index = parseInt(value, 10);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const name = index >= 0 ? `${regionName}_${index}` : regionName;
|
|
88
|
+
const trimmed = origW > 0 && origH > 0 && (origW !== atlasW || origH !== atlasH);
|
|
89
|
+
atlas.regions.push(createTextureAtlasRegion({
|
|
90
|
+
height: atlasH,
|
|
91
|
+
id,
|
|
92
|
+
name,
|
|
93
|
+
originalHeight: trimmed ? origH : null,
|
|
94
|
+
originalWidth: trimmed ? origW : null,
|
|
95
|
+
pivotX: null,
|
|
96
|
+
pivotY: null,
|
|
97
|
+
rotated,
|
|
98
|
+
sourceX: offsetX,
|
|
99
|
+
sourceY: offsetY,
|
|
100
|
+
trimmed,
|
|
101
|
+
width: atlasW,
|
|
102
|
+
x: atlasX,
|
|
103
|
+
y: atlasY,
|
|
104
|
+
}));
|
|
105
|
+
id++;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
i++; // skip unexpected keyed lines at page level
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return atlas;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=textureAtlasLibgdxParse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textureAtlasLibgdxParse.js","sourceRoot":"","sources":["../src/textureAtlasLibgdxParse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,kFAAkF;AAClF,kFAAkF;AAClF,4EAA4E;AAC5E,MAAM,UAAU,4BAA4B,CAAC,IAAY,EAAE,KAAmB;IAC5E,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CA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AU,CAAC;gBAChE,MAAM,OAAO,GAAG,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC;gBACjF,KAAK,CAAC,OAAO,CAAC,IAAI,CAChB,wBAAwB,CAAC;oBACvB,MAAM,EAAE,MAAM;oBACd,EAAE;oBACF,IAAI;oBACJ,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;oBACtC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;oBACrC,MAAM,EAAE,IAAI;oBACZ,MAAM,EAAE,IAAI;oBACZ,OAAO;oBACP,OAAO,EAAE,OAAO;oBAChB,OAAO,EAAE,OAAO;oBAChB,OAAO;oBACP,KAAK,EAAE,MAAM;oBACb,CAAC,EAAE,MAAM;oBACT,CAAC,EAAE,MAAM;iBACV,CAAC,CACH,CAAC;gBACF,EAAE,EAAE,CAAC;YACP,CAAC;iBAAM,CAAC;gBACN,CAAC,EAAE,CAAC,CAAC,4CAA4C;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TextureAtlas } from '@flighthq/types';
|
|
2
|
+
import type { TextureAtlasPackerDocument } from './textureAtlasPackerSchema';
|
|
3
|
+
export interface TextureAtlasPackerParseOptions {
|
|
4
|
+
/** If true, strips a leading slash and any path components from frame names. Defaults to false. */
|
|
5
|
+
stripPathPrefix?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseTextureAtlasPackerDocument(doc: TextureAtlasPackerDocument, atlas: TextureAtlas, options?: TextureAtlasPackerParseOptions): TextureAtlas;
|
|
8
|
+
export declare function parseTextureAtlasPackerJson(json: string, atlas: TextureAtlas, options?: TextureAtlasPackerParseOptions): TextureAtlas;
|
|
9
|
+
//# sourceMappingURL=textureAtlasPackerParse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textureAtlasPackerParse.d.ts","sourceRoot":"","sources":["../src/textureAtlasPackerParse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EAEV,0BAA0B,EAE3B,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,8BAA8B;IAC7C,mGAAmG;IACnG,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAGD,wBAAgB,+BAA+B,CAC7C,GAAG,EAAE,0BAA0B,EAC/B,KAAK,EAAE,YAAY,EACnB,OAAO,CAAC,EAAE,8BAA8B,GACvC,YAAY,CAGd;AAKD,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,YAAY,EACnB,OAAO,CAAC,EAAE,8BAA8B,GACvC,YAAY,CAId"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createTextureAtlasRegion } from '@flighthq/textureatlas';
|
|
2
|
+
// Convenience variant that accepts an already-parsed object (avoids a redundant JSON.parse).
|
|
3
|
+
export function parseTextureAtlasPackerDocument(doc, atlas, options) {
|
|
4
|
+
applyDocument(atlas, doc, options ?? {});
|
|
5
|
+
return atlas;
|
|
6
|
+
}
|
|
7
|
+
// Parses a TexturePacker JSON string and populates `atlas.regions`.
|
|
8
|
+
// Supports both the JSON-hash and JSON-array shapes.
|
|
9
|
+
// Existing regions in `atlas` are cleared. Returns `atlas` for convenience.
|
|
10
|
+
export function parseTextureAtlasPackerJson(json, atlas, options) {
|
|
11
|
+
const doc = JSON.parse(json);
|
|
12
|
+
applyDocument(atlas, doc, options ?? {});
|
|
13
|
+
return atlas;
|
|
14
|
+
}
|
|
15
|
+
// Populates `atlas.regions` from a parsed TexturePacker document.
|
|
16
|
+
// Existing regions are cleared before parsing.
|
|
17
|
+
function applyDocument(atlas, doc, options) {
|
|
18
|
+
atlas.regions.length = 0;
|
|
19
|
+
if (Array.isArray(doc.frames)) {
|
|
20
|
+
for (const entry of doc.frames) {
|
|
21
|
+
applyFrame(atlas, entry.filename, entry, options);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
for (const [frameName, entry] of Object.entries(doc.frames)) {
|
|
26
|
+
applyFrame(atlas, frameName, entry, options);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function applyFrame(atlas, name, entry, options) {
|
|
31
|
+
const normalized = normalizeFrameName(name, options.stripPathPrefix ?? false);
|
|
32
|
+
const region = createTextureAtlasRegion({
|
|
33
|
+
height: entry.rotated ? entry.frame.w : entry.frame.h,
|
|
34
|
+
id: atlas.regions.length,
|
|
35
|
+
name: normalized,
|
|
36
|
+
originalHeight: entry.trimmed ? entry.sourceSize.h : null,
|
|
37
|
+
originalWidth: entry.trimmed ? entry.sourceSize.w : null,
|
|
38
|
+
pivotX: entry.pivot !== undefined ? entry.pivot.x : null,
|
|
39
|
+
pivotY: entry.pivot !== undefined ? entry.pivot.y : null,
|
|
40
|
+
rotated: entry.rotated,
|
|
41
|
+
sourceX: entry.spriteSourceSize.x,
|
|
42
|
+
sourceY: entry.spriteSourceSize.y,
|
|
43
|
+
trimmed: entry.trimmed,
|
|
44
|
+
width: entry.rotated ? entry.frame.h : entry.frame.w,
|
|
45
|
+
x: entry.frame.x,
|
|
46
|
+
y: entry.frame.y,
|
|
47
|
+
});
|
|
48
|
+
atlas.regions.push(region);
|
|
49
|
+
}
|
|
50
|
+
// Normalize a frame name by optionally stripping path prefixes.
|
|
51
|
+
function normalizeFrameName(name, strip) {
|
|
52
|
+
if (!strip)
|
|
53
|
+
return name;
|
|
54
|
+
const slash = Math.max(name.lastIndexOf('/'), name.lastIndexOf('\\'));
|
|
55
|
+
return slash >= 0 ? name.slice(slash + 1) : name;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=textureAtlasPacker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K,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;KACjB,CAAC,CAAC;IACH,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC;AAED,gEAAgE;AAChE,SAAS,kBAAkB,CAAC,IAAY,EAAE,KAAc;IACtD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IACtE,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface TextureAtlasPackerRect {
|
|
2
|
+
h: number;
|
|
3
|
+
w: number;
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
export interface TextureAtlasPackerSize {
|
|
8
|
+
h: number;
|
|
9
|
+
w: number;
|
|
10
|
+
}
|
|
11
|
+
export interface TextureAtlasPackerPivot {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}
|
|
15
|
+
export interface TextureAtlasPackerFrameTag {
|
|
16
|
+
direction?: 'forward' | 'pingpong' | 'pingpong_reverse' | 'reverse';
|
|
17
|
+
from: number;
|
|
18
|
+
name: string;
|
|
19
|
+
to: number;
|
|
20
|
+
}
|
|
21
|
+
export interface TextureAtlasPackerHashFrame {
|
|
22
|
+
frame: TextureAtlasPackerRect;
|
|
23
|
+
pivot?: TextureAtlasPackerPivot;
|
|
24
|
+
rotated: boolean;
|
|
25
|
+
sourceSize: TextureAtlasPackerSize;
|
|
26
|
+
spriteSourceSize: TextureAtlasPackerRect;
|
|
27
|
+
trimmed: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface TextureAtlasPackerArrayFrame extends TextureAtlasPackerHashFrame {
|
|
30
|
+
filename: string;
|
|
31
|
+
}
|
|
32
|
+
export interface TextureAtlasPackerMeta {
|
|
33
|
+
app: string;
|
|
34
|
+
format: string;
|
|
35
|
+
frameTags?: TextureAtlasPackerFrameTag[];
|
|
36
|
+
image: string;
|
|
37
|
+
scale: number | string;
|
|
38
|
+
size: TextureAtlasPackerSize;
|
|
39
|
+
version: string;
|
|
40
|
+
}
|
|
41
|
+
/** Hash-keyed variant: `frames` is a plain object whose keys are frame names. */
|
|
42
|
+
export interface TextureAtlasPackerHashDocument {
|
|
43
|
+
frames: Record<string, TextureAtlasPackerHashFrame>;
|
|
44
|
+
meta: TextureAtlasPackerMeta;
|
|
45
|
+
}
|
|
46
|
+
/** Array variant: `frames` is an array and each entry carries a `filename` field. */
|
|
47
|
+
export interface TextureAtlasPackerArrayDocument {
|
|
48
|
+
frames: TextureAtlasPackerArrayFrame[];
|
|
49
|
+
meta: TextureAtlasPackerMeta;
|
|
50
|
+
}
|
|
51
|
+
export type TextureAtlasPackerDocument = TextureAtlasPackerArrayDocument | TextureAtlasPackerHashDocument;
|
|
52
|
+
//# sourceMappingURL=textureAtlasPackerSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textureAtlasPackerSchema.d.ts","sourceRoot":"","sources":["../src/textureAtlasPackerSchema.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,sBAAsB;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,sBAAsB;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,uBAAuB;IACtC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,kBAAkB,GAAG,SAAS,CAAC;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,sBAAsB,CAAC;IAC9B,KAAK,CAAC,EAAE,uBAAuB,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,sBAAsB,CAAC;IACnC,gBAAgB,EAAE,sBAAsB,CAAC;IACzC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,4BAA6B,SAAQ,2BAA2B;IAC/E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,0BAA0B,EAAE,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,EAAE,sBAAsB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,iFAAiF;AACjF,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;IACpD,IAAI,EAAE,sBAAsB,CAAC;CAC9B;AAED,qFAAqF;AACrF,MAAM,WAAW,+BAA+B;IAC9C,MAAM,EAAE,4BAA4B,EAAE,CAAC;IACvC,IAAI,EAAE,sBAAsB,CAAC;CAC9B;AAED,MAAM,MAAM,0BAA0B,GAAG,+BAA+B,GAAG,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// TexturePacker JSON schema — field names as they appear in the exported file.
|
|
2
|
+
// Reference: https://www.codeandweb.com/texturepacker/documentation/texture-settings
|
|
3
|
+
// Supports both the Hash (dict-keyed frames) and Array (array of frames with filename) variants.
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=textureAtlasPackerSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textureAtlasPackerSchema.js","sourceRoot":"","sources":["../src/textureAtlasPackerSchema.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,qFAAqF;AACrF,iGAAiG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TextureAtlas } from '@flighthq/types';
|
|
2
|
+
export interface TextureAtlasStarlingParseOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Atlas image width in pixels. Starling XML omits atlas dimensions; supply to allow UV
|
|
5
|
+
* computation. When omitted, the atlas image dimensions will be used when available.
|
|
6
|
+
*/
|
|
7
|
+
imageWidth?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Atlas image height in pixels.
|
|
10
|
+
*/
|
|
11
|
+
imageHeight?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function parseTextureAtlasStarlingXml(xml: string, atlas: TextureAtlas, _options?: TextureAtlasStarlingParseOptions): TextureAtlas;
|
|
14
|
+
//# sourceMappingURL=textureAtlasStarlingParse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textureAtlasStarlingParse.d.ts","sourceRoot":"","sources":["../src/textureAtlasStarlingParse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,WAAW,gCAAgC;IAC/C;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,YAAY,EACnB,QAAQ,CAAC,EAAE,gCAAgC,GAC1C,YAAY,CA2Cd"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createTextureAtlasRegion } from '@flighthq/textureatlas';
|
|
2
|
+
import { parseXmlDocument } from '@flighthq/xml';
|
|
3
|
+
// Populates `atlas.regions` from a Starling / Sparrow XML string.
|
|
4
|
+
// Existing regions are cleared before parsing. Returns `atlas` for convenience.
|
|
5
|
+
export function parseTextureAtlasStarlingXml(xml, atlas, _options) {
|
|
6
|
+
atlas.regions.length = 0;
|
|
7
|
+
const root = parseXmlDocument(xml);
|
|
8
|
+
if (!root)
|
|
9
|
+
return atlas;
|
|
10
|
+
// The TextureAtlas element may be the root or a child.
|
|
11
|
+
const atlasEl = root.name === 'TextureAtlas' ? root : (root.children.find((c) => c.name === 'TextureAtlas') ?? root);
|
|
12
|
+
let id = 0;
|
|
13
|
+
for (const el of atlasEl.children) {
|
|
14
|
+
if (el.name !== 'SubTexture')
|
|
15
|
+
continue;
|
|
16
|
+
const a = el.attributes;
|
|
17
|
+
if (!a['name'])
|
|
18
|
+
continue;
|
|
19
|
+
const x = parseFloat(a['x'] ?? '0');
|
|
20
|
+
const y = parseFloat(a['y'] ?? '0');
|
|
21
|
+
const width = parseFloat(a['width'] ?? '0');
|
|
22
|
+
const height = parseFloat(a['height'] ?? '0');
|
|
23
|
+
const frameWidth = a['frameWidth'] !== undefined ? parseFloat(a['frameWidth']) : null;
|
|
24
|
+
const frameHeight = a['frameHeight'] !== undefined ? parseFloat(a['frameHeight']) : null;
|
|
25
|
+
const trimmed = frameWidth !== null || a['frameX'] !== undefined;
|
|
26
|
+
const rotated = a['rotated'] === 'true';
|
|
27
|
+
// Pivot in Starling is in source (original frame) pixel coordinates.
|
|
28
|
+
const pivotX = a['pivotX'] !== undefined ? parseFloat(a['pivotX']) : null;
|
|
29
|
+
const pivotY = a['pivotY'] !== undefined ? parseFloat(a['pivotY']) : null;
|
|
30
|
+
atlas.regions.push(createTextureAtlasRegion({
|
|
31
|
+
height,
|
|
32
|
+
id,
|
|
33
|
+
name: a['name'],
|
|
34
|
+
originalHeight: trimmed ? (frameHeight ?? height) : null,
|
|
35
|
+
originalWidth: trimmed ? (frameWidth ?? width) : null,
|
|
36
|
+
pivotX,
|
|
37
|
+
pivotY,
|
|
38
|
+
rotated,
|
|
39
|
+
sourceX: a['frameX'] !== undefined ? -parseFloat(a['frameX']) : 0,
|
|
40
|
+
sourceY: a['frameY'] !== undefined ? -parseFloat(a['frameY']) : 0,
|
|
41
|
+
trimmed,
|
|
42
|
+
width,
|
|
43
|
+
x,
|
|
44
|
+
y,
|
|
45
|
+
}));
|
|
46
|
+
id++;
|
|
47
|
+
}
|
|
48
|
+
return atlas;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=textureAtlasStarlingParse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textureAtlasStarlingParse.js","sourceRoot":"","sources":["../src/textureAtlasStarlingParse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAcjD,kEAAkE;AAClE,gFAAgF;AAChF,MAAM,UAAU,4BAA4B,CAC1C,GAAW,EACX,KAAmB,EACnB,QAA2C;IAE3C,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IACzB,MAAM,IAAI,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,uDAAuD;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC;IACrH,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,KAAK,MAAM,EAA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