@melonjs/spine-plugin 2.2.0 → 3.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.0 - _2026-06-14_
4
+
5
+ ### **BREAKING CHANGES**
6
+
7
+ - **Spine 4.3 editor required** — bundled Spine runtimes bumped from `^4.2.114` to `^4.3.7`. The 4.2 and 4.3 skeleton data formats are incompatible both ways: existing `.json`/`.skel` exports must be re-exported from a Spine 4.3 editor, and 4.3 exports will not load on plugin 2.x
8
+ - the plugin now sets `Skeleton.yDown = true` (the official 4.3 Y-down switch, same approach as Spine's own pixi/phaser/canvaskit integrations). Code that reached into `spineObject.skeleton` and compensated for the old manual Y-flip (root bone `scaleY = -1`, inverted physics gravity) must drop those workarounds — the runtime now handles Y-down natively
9
+ - Spine 4.3 moved bone/slot state into poses: code accessing `bone.x/.scaleX/.worldX` etc. through `spineObject.skeleton` must use `bone.pose.*` (unconstrained, for writing) or `bone.appliedPose.*` (constrained, for reading world transforms); `slot.color`/`slot.getAttachment()` are now `slot.appliedPose.color`/`slot.appliedPose.attachment`
10
+ - other 4.3 core renames that surface through `spineObject.skeleton`: `setToSetupPose()` → `setupPose()`, `physicsConstraints` → `physics`, `MixBlend`/`MixDirection` removed (use `TrackEntry.additive`), `MeshAttachment.getParentMesh()` → `getSourceMesh()`. The plugin's own `Spine.setToSetupPose()` wrapper keeps its name
11
+
12
+ ### Added
13
+
14
+ - Spine 4.3 feature support inherited with the runtime bump: slider constraints, sequence timelines, non-linear animation mixing (`TrackEntry.mixInterpolation`), convex/inverse clipping, physics force direction vectors (`skeleton.windX/Y`, `gravityX/Y`)
15
+ - **WebGL context-loss recovery** — the plugin now survives a `webglcontextlost`/`webglcontextrestored` cycle (melonJS ≥ 19.7 recovery machinery): `SpineBatcher` builds its GPU resources in `init()` so the renderer's restore path can re-create them, and all spine GL resources (atlas textures, debug pipeline) are funneled through a single shared canvas-backed `ManagedWebGLRenderingContext` so spine's own restorables actually fire (a managed context built from a raw GL context has no element to listen on and silently never restores)
16
+
17
+ ### Changed
18
+
19
+ - minimum melonJS version is now **19.7.1** (was 18.3.0) — required for the WebGL context-loss restore + blend-cache invalidation fix the plugin's recovery path relies on
20
+ - skeleton positioning now goes through `skeleton.x/y` instead of writing to the root bone pose — root-bone-relative user code (e.g. custom bone offsets) is unaffected
21
+ - `flipX()`/`flipY()` JSDoc corrected: flipping is around the root bone, not the visual center (behavior unchanged, was always root-relative)
22
+ - mesh auto-detection for the canvas renderer now uses the public `Skin.getAttachments()` API instead of walking spine's internal `skin.attachments` array
23
+
24
+ ### Performance
25
+
26
+ - Canvas `SkeletonRenderer` mesh vertex buffer slimmed from 8 floats per vertex down to 2 (positions only) — first removed the 4 dead per-vertex color floats (canvas tinting is applied per slot via `setTint()`/`setGlobalAlpha()`), then dropped the UV interleave entirely (UVs now read straight from `sequence.getUVs(index)` in `drawMesh`). Halves the buffer twice over, eliminates a per-vertex copy pass, and removes the dedicated `computeMeshVertices` method. Verified pixel-identical across all 15 example skeletons (cold-start harness drift falls in the same noise floor with the change applied or not)
27
+
28
+ ### Fixed
29
+
30
+ - Canvas `SkeletonRenderer` no longer corrupts mesh vertex data while a `ClippingAttachment` is active — the stride-2 "clipped vertex size" was inherited from spine-webgl's `clipTriangles` repacking, which the canvas path never performs: positions were written at stride 2 then read at the full vertex stride, scrambling any mesh drawn inside an active clip (latent since the 4.2 plugin; canvas meshes are clipped per-triangle, so no example skeleton ever exposed it)
31
+ - Canvas `SkeletonRenderer` now uses `color.alpha` (the melonJS `Color` accessor) instead of `color.a`, which was always `undefined`. Canvas's `globalAlpha = undefined` is silently ignored, so slot-alpha animation never faded attachments — the canvas renderer behaved as if every slot were fully opaque. Visible on `powerup` (the trailing stars stayed at full opacity instead of fading) and any other skeleton with slot-alpha keyframes
32
+ - Canvas `SkeletonRenderer` correctly handles atlas regions packed at 90° rotation (`region.degrees === 90`) — the `translate(-w/2, -h/2)` after the dimension swap was using the *pre-swap* half-dimensions, so any attachment whose texture region was rotated in the atlas drew with its quad offset by `±(w−h)/2`. Visible as the tank turret floating detached from the chassis and the raptor rider's visor tilted off his head on canvas (WebGL was unaffected). Now matches the official `spine-canvas` SkeletonRenderer math by re-deriving the halves from post-swap `w`/`h`
33
+
34
+ ### Removed
35
+
36
+ - all manual Y-down plumbing made obsolete by `Skeleton.yDown`: the root-bone `scaleY` inversion in `setToSetupPose()`, the per-constraint physics gravity flip in `setSkeleton()`, and the `+90°` Canvas rotation offset in `rotate()`
37
+
38
+ ## 2.2.1 - 2026-05-11
39
+
40
+ ### Changed
41
+ - Bump bundled Spine runtimes (`@esotericsoftware/spine-canvas`, `@esotericsoftware/spine-core`, `@esotericsoftware/spine-webgl`) range from `^4.2.109` to `^4.2.114`. Picks up the empty-atlas hang fix in `AssetManagerBase` (4.2.113) — `loadTextureAtlas` no longer waits forever on an atlas with zero pages. No plugin API change.
42
+
3
43
  ## 2.2.0 - 2026-04-15
4
44
 
5
45
  ### Added
package/README.md CHANGED
@@ -1,20 +1,20 @@
1
1
  # melonJS Spine Plugin
2
2
 
3
- A [Spine](http://en.esotericsoftware.com/spine-in-depth) 4.2 runtime integration for the [melonJS](http://www.melonjs.org) game engine, using the official [@esotericsoftware/spine-webgl](https://www.npmjs.com/package/@esotericsoftware/spine-webgl) and [@esotericsoftware/spine-canvas](https://www.npmjs.com/package/@esotericsoftware/spine-canvas) runtimes.
3
+ A [Spine](http://en.esotericsoftware.com/spine-in-depth) 4.x runtime integration for the [melonJS](http://www.melonjs.org) game engine, using the official [@esotericsoftware/spine-webgl](https://www.npmjs.com/package/@esotericsoftware/spine-webgl) and [@esotericsoftware/spine-canvas](https://www.npmjs.com/package/@esotericsoftware/spine-canvas) runtimes.
4
4
 
5
5
  ![melonjs-spine-gif](https://github.com/melonjs/spine-plugin/assets/4033090/dc259c8e-def6-419e-83a9-cda374715686)
6
6
 
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/melonjs/melonJS/blob/master/packages/spine-plugin/LICENSE)
8
8
  [![NPM Package](https://img.shields.io/npm/v/@melonjs/spine-plugin)](https://www.npmjs.com/package/@melonjs/spine-plugin)
9
- [![Spine Runtime](https://img.shields.io/badge/spine--runtime-4.2-orange)](http://esotericsoftware.com/spine-runtimes)
9
+ [![Spine Runtime](https://img.shields.io/badge/spine--runtime-4.3-orange)](http://esotericsoftware.com/spine-runtimes)
10
10
 
11
- [Live Example](https://melonjs.github.io/melonJS/examples/#/spine) — 17 official Spine characters including spineboy, raptor, owl, dragon, and more
11
+ [Live Example](https://melonjs.github.io/melonJS/examples/#/spine) — 15 official Spine characters including spineboy, raptor, owl, dragon, and more
12
12
 
13
13
  ## Features
14
14
  -------------------------------------------------------------------------------
15
15
  - **WebGL rendering** via custom `SpineBatcher` extending melonJS `Batcher` with two-color tinting and indexed drawing
16
16
  - **Canvas rendering** with full mesh, clipping, tinting, and blend mode support
17
- - **Spine 4.2 physics** support with automatic gravity correction for Y-down coordinate system
17
+ - **Spine physics** support native Y-down handling via the official `Skeleton.yDown` runtime switch, including physics force direction vectors (`windX/Y`, `gravityX/Y`)
18
18
  - **Two-color tinting** (dark/light color) using Spine's official shader
19
19
  - **Blend modes** (Normal, Additive, Multiply, Screen) with premultiplied alpha support
20
20
  - **Clipping attachments** via melonJS masking (canvas) and Spine's SkeletonClipping (WebGL)
@@ -30,7 +30,7 @@ A [Spine](http://en.esotericsoftware.com/spine-in-depth) 4.2 runtime integration
30
30
  ## Installation
31
31
  -------------------------------------------------------------------------------
32
32
  This plugin is already bundled with the required Spine [4.x runtime](package.json#dependencies), so there is no need to install it separately.
33
- >Note: this plugin requires melonJS version 18.3.0 or higher.
33
+ >Note: this plugin requires melonJS version 19.7.1 or higher.
34
34
 
35
35
  To install the plugin using npm:
36
36
 
@@ -125,12 +125,15 @@ me.loader.preload(DataManifest, function() {
125
125
 
126
126
  | @melonjs/spine-plugin | melonJS | spine-runtime |
127
127
  |---|---|---|
128
+ | v3.0.0 | v19.7.1 (or higher) | v4.3.x |
128
129
  | v2.2.0 | v18.3.0 (or higher) | v4.2.x |
129
130
  | v2.1.0 | v18.3.0 (or higher) | v4.2.x |
130
131
  | v2.0.1 | v18.2.1 (or higher) | v4.2.x |
131
132
  | v2.0.0 | v18.2.0 | v4.2.x |
132
133
  | v1.5.x | v15.12.x — v18.0.x | v4.1, v4.2-beta |
133
134
 
135
+ > **Note:** skeleton data is editor-version locked — plugin 3.x requires assets exported from a Spine **4.3** editor; 4.2 exports will not load (and vice-versa on plugin 2.x).
136
+
134
137
  ## Questions, need help ?
135
138
  -------------------------------------------------------------------------------
136
139
  If you need technical support, you can contact us through the following channels:
@@ -1 +1 @@
1
- {"version":3,"file":"AssetManager.d.ts","sourceRoot":"","sources":["../src/AssetManager.js"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH;IACC;;;OAGG;IACH,sBAHW,cAAc,GAAC,aAAa,eAC5B,MAAM,EA0ChB;IAvCA;;;OAGG;IACH,sEAG4C;IAkC7C;;;OAGG;IACH,sBAFW,MAAM,QAIhB;IAED;;;;;;;;;OASG;IACH,iBARW,MAAM,QACN,MAAM,QAgBhB;IAED;;;;;OAKG;IACH,wBAJW,MAAM,+CAMhB;IAED;;;;;OAKG;IACH,iBAJW,MAAM,+CAMhB;IAED;;;;;OAKG;IACH,eAJW,MAAM,+CAMhB;IAED;;;;OAIG;IACH,wBAEC;IAED;;;;OAIG;IACH,cAHW,MAAM,GACJ,GAAC,CAIb;IAED;;OAEG;IACH,gBAEC;CACD;4BA3I2B,+BAA+B;6BAD9B,gCAAgC"}
1
+ {"version":3,"file":"AssetManager.d.ts","sourceRoot":"","sources":["../src/AssetManager.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH;IACC;;;OAGG;IACH,sBAHW,cAAc,GAAC,aAAa,eAC5B,MAAM,EA+ChB;IA5CA;;;OAGG;IACH,sEAQ4C;IAkC7C;;;OAGG;IACH,sBAFW,MAAM,QAIhB;IAED;;;;;;;;;OASG;IACH,iBARW,MAAM,QACN,MAAM,QAgBhB;IAED;;;;;OAKG;IACH,wBAJW,MAAM,+CAMhB;IAED;;;;;OAKG;IACH,iBAJW,MAAM,+CAMhB;IAED;;;;;OAKG;IACH,eAJW,MAAM,+CAMhB;IAED;;;;OAIG;IACH,wBAEC;IAED;;;;OAIG;IACH,cAHW,MAAM,GACJ,GAAC,CAIb;IAED;;OAEG;IACH,gBAEC;CACD;4BAjJ2B,+BAA+B;6BAD9B,gCAAgC"}
@@ -28,7 +28,6 @@ export default class SkeletonRenderer {
28
28
  */
29
29
  premultipliedAlpha: boolean;
30
30
  tintColor: MColor;
31
- tempColor: MColor;
32
31
  clipper: SkeletonClipping;
33
32
  clippingVertices: any[];
34
33
  clippingMask: Polygon;
@@ -44,38 +43,31 @@ export default class SkeletonRenderer {
44
43
  * @param {HTMLImageElement} image
45
44
  * @param {Bone} bone
46
45
  * @param {RegionAttachment} attachment
46
+ * @param {SlotPose} slotPose - the slot's applied pose (resolves sequence offsets)
47
47
  * @param {TextureRegion} region
48
48
  * @param {Polygon|null} mask - clipping mask if active
49
49
  * @param {boolean} debug - whether to draw debug outline
50
50
  * @ignore
51
51
  */
52
- drawRegion(renderer: CanvasRenderer, image: HTMLImageElement, bone: Bone, attachment: RegionAttachment, region: TextureRegion, mask: Polygon | null, debug: boolean): void;
52
+ drawRegion(renderer: CanvasRenderer, image: HTMLImageElement, bone: Bone, attachment: RegionAttachment, slotPose: SlotPose, region: TextureRegion, mask: Polygon | null, debug: boolean): void;
53
53
  /**
54
54
  * Draw a mesh attachment as a series of textured triangles.
55
55
  * @param {CanvasRenderer} renderer
56
56
  * @param {HTMLImageElement} image
57
- * @param {Float32Array} vertices - world vertices
57
+ * @param {Float32Array} vertices - world positions, stride 2 (x, y per vertex)
58
+ * @param {NumberArrayLike} uvs - atlas UVs from `sequence.getUVs(index)`, stride 2
58
59
  * @param {number[]} triangles - triangle indices
59
60
  * @ignore
60
61
  */
61
- drawMesh(renderer: CanvasRenderer, image: HTMLImageElement, vertices: Float32Array, triangles: number[]): void;
62
+ drawMesh(renderer: CanvasRenderer, image: HTMLImageElement, vertices: Float32Array, uvs: NumberArrayLike, triangles: number[]): void;
62
63
  /**
63
64
  * Draw a single textured triangle using affine transform.
64
65
  * @ignore
65
66
  */
66
67
  drawTriangle(renderer: any, img: any, x0: any, y0: any, u0: any, v0: any, x1: any, y1: any, u1: any, v1: any, x2: any, y2: any, u2: any, v2: any): void;
67
- /**
68
- * Compute world vertices for a mesh attachment with color and UV data.
69
- * @param {Slot} slot
70
- * @param {MeshAttachment} mesh
71
- * @param {number} vertexSize - floats per vertex
72
- * @ignore
73
- */
74
- computeMeshVertices(slot: Slot, mesh: MeshAttachment, vertexSize: number): void;
75
68
  }
76
69
  import { Color as MColor } from "melonjs";
77
70
  import { SkeletonClipping } from "@esotericsoftware/spine-core";
78
71
  import { Polygon } from "melonjs";
79
72
  import { RegionAttachment } from "@esotericsoftware/spine-core";
80
- import { MeshAttachment } from "@esotericsoftware/spine-core";
81
73
  //# sourceMappingURL=SkeletonRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SkeletonRenderer.d.ts","sourceRoot":"","sources":["../src/SkeletonRenderer.js"],"names":[],"mappings":"AA0BA;;;;;;GAMG;AACH;IACC;;;;;;;OAOG;IACH,mBAHU,OAAO,CAGS;IAE1B;;;;OAIG;IACH,gBAHU,OAAO,CAGM;IAEvB;;;;OAIG;IACH,oBAHU,OAAO,CAGU;IAG3B,kBAAyB;IACzB,kBAAyB;IAGzB,0BAAiC;IACjC,wBAAsB;IACtB,sBAIG;IAEH;;;;OAIG;IACH,eAHW,cAAc,YACd,QAAQ,QAoGlB;IAED;;;;;;;;;;OAUG;IACH,qBATW,cAAc,SACd,gBAAgB,QAChB,IAAI,cACJ,gBAAgB,UAChB,aAAa,QACb,OAAO,GAAC,IAAI,SACZ,OAAO,QAqDjB;IAED;;;;;;;OAOG;IACH,mBANW,cAAc,SACd,gBAAgB,YAChB,YAAY,aACZ,MAAM,EAAE,QA8BlB;IAED;;;OAGG;IACH,wJA2CC;IAED;;;;;;OAMG;IACH,0BALW,IAAI,QACJ,cAAc,cACd,MAAM,QAwChB;CACD;gCA5WuD,SAAS;iCAD1D,8BAA8B;wBACmB,SAAS;iCAD1D,8BAA8B;+BAA9B,8BAA8B"}
1
+ {"version":3,"file":"SkeletonRenderer.d.ts","sourceRoot":"","sources":["../src/SkeletonRenderer.js"],"names":[],"mappings":"AA2BA;;;;;;GAMG;AACH;IACC;;;;;;;OAOG;IACH,mBAHU,OAAO,CAGS;IAE1B;;;;OAIG;IACH,gBAHU,OAAO,CAGM;IAEvB;;;;OAIG;IACH,oBAHU,OAAO,CAGU;IAG3B,kBAAyB;IAGzB,0BAAiC;IACjC,wBAAsB;IACtB,sBAIG;IAEH;;;;OAIG;IACH,eAHW,cAAc,YACd,QAAQ,QA2HlB;IAED;;;;;;;;;;;OAWG;IACH,qBAVW,cAAc,SACd,gBAAgB,QAChB,IAAI,cACJ,gBAAgB,YAChB,QAAQ,UACR,aAAa,QACb,OAAO,GAAC,IAAI,SACZ,OAAO,QAiEjB;IAED;;;;;;;;OAQG;IACH,mBAPW,cAAc,SACd,gBAAgB,YAChB,YAAY,OACZ,eAAe,aACf,MAAM,EAAE,QA8BlB;IAED;;;OAGG;IACH,wJA2CC;CACD;gCAnWuD,SAAS;iCAD1D,8BAA8B;wBACmB,SAAS;iCAD1D,8BAA8B"}
package/build/Spine.d.ts CHANGED
@@ -79,7 +79,6 @@ export default class Spine extends Renderable {
79
79
  currentTrack: TrackEntry;
80
80
  /** @ignore */
81
81
  isWebGL: boolean;
82
- canvas: any;
83
82
  spineBatcher: any;
84
83
  shapesShader: spineWebGL.Shader | undefined;
85
84
  shapes: spineWebGL.ShapeRenderer | undefined;
@@ -115,13 +114,13 @@ export default class Spine extends Renderable {
115
114
  setSkeleton(atlasFile: string, jsonFile: string): void;
116
115
  premultipliedAlpha: any;
117
116
  /**
118
- * Flip the Spine skeleton on the horizontal axis (around its center).
117
+ * Flip the Spine skeleton on the horizontal axis (around its root bone).
119
118
  * @param {boolean} [flip=true] - `true` to flip this Spine object.
120
119
  * @returns {Spine} Reference to this object for method chaining
121
120
  */
122
121
  flipX(flip?: boolean): Spine;
123
122
  /**
124
- * Flip the Spine skeleton on the vertical axis (around its center).
123
+ * Flip the Spine skeleton on the vertical axis (around its root bone).
125
124
  * @param {boolean} [flip=true] - `true` to flip this Spine object.
126
125
  * @returns {Spine} Reference to this object for method chaining
127
126
  */
@@ -153,6 +152,12 @@ export default class Spine extends Renderable {
153
152
  * Called automatically when the renderable is removed from the world.
154
153
  */
155
154
  dispose(): void;
155
+ /**
156
+ * Called when the renderable is destroyed (removed from the world).
157
+ * Cleans up GPU resources automatically.
158
+ * @ignore
159
+ */
160
+ onDestroyEvent(): void;
156
161
  /**
157
162
  * Sets the current animation for a track by animation index, discarding any queued animations.
158
163
  * @param {number} trackIndex - the track index
@@ -1 +1 @@
1
- {"version":3,"file":"Spine.d.ts","sourceRoot":"","sources":["../src/Spine.js"],"names":[],"mappings":"AAWA;;;;GAIG;AACH;IAkCC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,eApCW,MAAM,KACN,MAAM,YAEd;QAA0B,SAAS;QACT,QAAQ;QACR,OAAO;KACjC,EA2FF;IAnID,gDAAQ;IACR,cAAS;IACT,0BAAO;IACP,oBAAe;IACf,iEAAiB;IACjB,UAAK;IACL,gCAAW;IACX,8BAAS;IACT;;;MAGE;IAEF;;;;;;;;;;;;;;;;;OAiBG;IACH,cAhBU,UAAU,CAgBP;IAmDZ,cAAc;IACd,iBAAyC;IAIxC,YAA0C;IAK1C,kBAAkD;IASlD,4CAA+D;IAC/D,6CAAyD;IACzD,oEAEC;IAmBF,gBAAsC;IAGrC,6BAAiC;IACjC,8BAAmC;IAcrC,0BANU,OAAO,EAQhB;IAX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xqBwC,SAAS;4BADtB,+BAA+B;6BAP9B,gCAAgC;uBAQpB,SAAS;6BAErB,uBAAuB"}
@@ -5,16 +5,21 @@
5
5
  */
6
6
  export default class SpineBatcher extends Batcher {
7
7
  /**
8
+ * Initialize (or re-initialize) the batcher.
9
+ * Settings are built here rather than in the constructor so the
10
+ * renderer's context-restore recovery can re-create all GPU
11
+ * resources with a bare `batcher.init(renderer)` call, matching
12
+ * the engine's built-in batchers.
8
13
  * @param {WebGLRenderer} renderer - the current WebGL renderer session
9
- * @param {WebGLRenderingContext|WebGL2RenderingContext} canvas - the GL context for Spine shader creation
14
+ * @ignore
10
15
  */
11
- constructor(renderer: WebGLRenderer, canvas: WebGLRenderingContext | WebGL2RenderingContext);
16
+ init(renderer: WebGLRenderer): void;
12
17
  /**
13
18
  * the current texture bound to the batcher
14
19
  * @type {object|null}
15
20
  * @ignore
16
21
  */
17
- lastTexture: object | null;
22
+ lastTexture: object | null | undefined;
18
23
  /**
19
24
  * Set the blend mode for subsequent draw calls.
20
25
  * Maps Spine BlendMode enum to melonJS blend mode strings.
@@ -1 +1 @@
1
- {"version":3,"file":"SpineBatcher.d.ts","sourceRoot":"","sources":["../src/SpineBatcher.js"],"names":[],"mappings":"AAcA;;;;GAIG;AACH;IACC;;;OAGG;IACH,sBAHW,aAAa,UACb,qBAAqB,GAAC,sBAAsB,EAuDtD;IANA;;;;OAIG;IACH,aAHU,MAAM,GAAC,IAAI,CAGE;IAGxB;;;;;OAKG;IACH,wBAHW,MAAM,sBACN,OAAO,QAOjB;IAED;;;;;;OAMG;IACH,cAJW,MAAM,YACN,SAAS,CAAC,MAAM,CAAC,WACjB,MAAM,EAAE,QAwBlB;CAaD;wBArIuB,SAAS"}
1
+ {"version":3,"file":"SpineBatcher.d.ts","sourceRoot":"","sources":["../src/SpineBatcher.js"],"names":[],"mappings":"AAeA;;;;GAIG;AACH;IACC;;;;;;;;OAQG;IACH,eAHW,aAAa,QA0DvB;IANA;;;;OAIG;IACH,uCAAuB;IAGxB;;;;;OAKG;IACH,wBAHW,MAAM,sBACN,OAAO,QAOjB;IAED;;;;;;OAMG;IACH,cAJW,MAAM,YACN,SAAS,CAAC,MAAM,CAAC,WACjB,MAAM,EAAE,QAwBlB;CAaD;wBA7IuB,SAAS"}
@@ -4,7 +4,13 @@
4
4
  * @augments plugin.BasePlugin
5
5
  */
6
6
  export class SpinePlugin extends plugin.BasePlugin {
7
- constructor();
7
+ /**
8
+ * @param {Application} [app] - the application instance this plugin
9
+ * belongs to (defaults to the active game instance). Pass it through
10
+ * `plugin.register(SpinePlugin, "SpinePlugin", app)` when running
11
+ * multiple applications.
12
+ */
13
+ constructor(app?: Application);
8
14
  assetManager: AssetManager;
9
15
  }
10
16
  import { plugin } from "melonjs";
@@ -1 +1 @@
1
- {"version":3,"file":"SpinePlugin.d.ts","sourceRoot":"","sources":["../src/SpinePlugin.js"],"names":[],"mappings":"AAWA;;;;GAIG;AACH;IACC,cAkBC;IALA,2BAAuD;CAMxD;uBApCgD,SAAS;yBAQjC,gBAAgB"}
1
+ {"version":3,"file":"SpinePlugin.d.ts","sourceRoot":"","sources":["../src/SpinePlugin.js"],"names":[],"mappings":"AAWA;;;;GAIG;AACH;IACC;;;;;OAKG;IACH,kBALW,WAAW,EAuBrB;IALA,2BAAuD;CAMxD;uBA1CgD,SAAS;yBAQjC,gBAAgB"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Return the shared spine ManagedWebGLRenderingContext for the given canvas,
3
+ * creating it on first use.
4
+ *
5
+ * One shared instance per canvas matters for WebGL context-loss recovery:
6
+ * Spine's GLTexture/Shader/Mesh register themselves as restorables on their
7
+ * managed context, but a managed context only listens for
8
+ * `webglcontextrestored` when constructed from a canvas (a raw
9
+ * WebGLRenderingContext gives it no element to listen on). Funneling every
10
+ * spine GL resource through this single canvas-backed instance guarantees
11
+ * they are all restored after a context loss.
12
+ * @param {HTMLCanvasElement} canvas - the canvas the melonJS WebGL renderer draws to
13
+ * @returns {ManagedWebGLRenderingContext} the shared managed context
14
+ * @ignore
15
+ */
16
+ export function getManagedContext(canvas: HTMLCanvasElement): ManagedWebGLRenderingContext;
17
+ import { ManagedWebGLRenderingContext } from "@esotericsoftware/spine-webgl";
18
+ //# sourceMappingURL=glContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glContext.d.ts","sourceRoot":"","sources":["../src/glContext.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,0CAJW,iBAAiB,GACf,4BAA4B,CAUxC;6CA1B4C,+BAA+B"}