@melonjs/spine-plugin 1.3.0 → 1.5.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 +19 -1
- package/README.md +52 -17
- package/dist/@melonjs/spine-plugin.d.ts +374 -101
- package/dist/@melonjs/spine-plugin.js +544 -129
- package/package.json +11 -10
- package/src/AssetManager.js +99 -12
- package/src/SpinePlugin.js +24 -0
- package/src/index.js +263 -45
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.5.0 - 2023-09-23
|
|
4
|
+
|
|
5
|
+
- fix the `addAnimation()` method not returning the corresponding set TrackEntry
|
|
6
|
+
- fix the base renderable `flip[X/Y]` method when used/applied to the Spine renderable
|
|
7
|
+
- add a `isCurrentAnimation()` method that returns true if the given name is corresponding to the current track current animation
|
|
8
|
+
- expose the `currentTrack` property to access the corresponding current animation track entry
|
|
9
|
+
- clarify in the readme that the current plugin support both the 4.1 and 4.2-beta Spine runtime versions
|
|
10
|
+
- the spine-plugin now requires to be properly registered using `me.plugin.register(SpinePlugin);`
|
|
11
|
+
- the spine-plugin now requires melonJS v15.12.0 or higher
|
|
12
|
+
- add check for minimum melonJS version when the plugin is registered
|
|
13
|
+
- restructure code to adhere to the updated plugin API and get a proper reference to the melonjs renderer instance
|
|
14
|
+
|
|
15
|
+
## 1.4.0 - 2023-09-05
|
|
16
|
+
|
|
17
|
+
- add support for loading spine assets through the melonJS preloader (see README)
|
|
18
|
+
- add inline documentation for the Spine class, properties and methods
|
|
19
|
+
- console now display both the plugin and spine runtime versions
|
|
20
|
+
|
|
21
|
+
## 1.3.0 - 2023-08-28
|
|
4
22
|
|
|
5
23
|
- add support for Mesh Attachement
|
|
6
24
|
- added more examples under the test folder and separated them into individual files
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# melonJS Spine Plugin
|
|
2
2
|
|
|
3
|
-
a [Spine](http://en.esotericsoftware.com/spine-in-depth) 4.
|
|
3
|
+
a [Spine](http://en.esotericsoftware.com/spine-in-depth) 4.x plugin implementation for [melonJS 2](http://www.melonjs.org)
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
@@ -11,10 +11,10 @@ a [Spine](http://en.esotericsoftware.com/spine-in-depth) 4.1 plugin implementati
|
|
|
11
11
|
[](https://www.jsdelivr.com/package/npm/@melonjs/spine-plugin)
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
Installation
|
|
14
|
+
## Installation
|
|
15
15
|
-------------------------------------------------------------------------------
|
|
16
|
-
this plugin is already bundled with the required Spine runtime, so there is no need to install it separately.
|
|
17
|
-
>Note: this plugin requires melonJS version 15.
|
|
16
|
+
this plugin is already bundled with the required Spine [4.x runtime](package.json#dependencies), so there is no need to install it separately.
|
|
17
|
+
>Note: this plugin requires melonJS version 15.12 or higher.
|
|
18
18
|
|
|
19
19
|
To install the plugin using npm :
|
|
20
20
|
|
|
@@ -22,24 +22,59 @@ To install the plugin using npm :
|
|
|
22
22
|
|
|
23
23
|
Then import and use the plugin in your project. For example:
|
|
24
24
|
```JavaScript
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
import { SpinePlugin } from '@melonjs/spine-plugin';
|
|
26
|
+
import * as me from 'melonjs';
|
|
27
|
+
|
|
28
|
+
// register the plugin
|
|
29
|
+
me.plugin.register(SpinePlugin);
|
|
30
|
+
|
|
31
|
+
// prepare/declare assets for the preloader
|
|
32
|
+
const DataManifest = [
|
|
33
|
+
{
|
|
34
|
+
"name": "alien-ess.json",
|
|
35
|
+
"type": "spine",
|
|
36
|
+
"src": "data/spine/alien-ess.json"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "alien.atlas",
|
|
40
|
+
"type": "spine",
|
|
41
|
+
"src": "data/spine/alien.atlas"
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
// import default Spine class
|
|
46
|
+
import Spine from '@melonjs/spine-plugin';
|
|
47
|
+
|
|
48
|
+
// preload assets
|
|
49
|
+
me.loader.preload(DataManifest, async function() {
|
|
50
|
+
|
|
51
|
+
// create a new Spine Renderable
|
|
52
|
+
let spineAlien = new Spine(100, 100, {atlasFile: "alien.atlas", jsonFile: "alien-ess.json"});
|
|
53
|
+
|
|
54
|
+
// set default animation
|
|
55
|
+
spineAlien.setAnimation(0, "death", true);
|
|
56
|
+
|
|
57
|
+
// add it to the game world
|
|
58
|
+
me.game.world.addChild(spineAlien);
|
|
59
|
+
|
|
37
60
|
}
|
|
38
61
|
```
|
|
62
|
+
>Note: use "spine" as a value for the `type` property to indicate which assets and are actual Spine assets and to be loaded using the plugin (requires version 1.4.0 or higher of the Spine plugin)
|
|
39
63
|
|
|
40
64
|
for more details, see a complete usage example in the [test](test) folder
|
|
41
65
|
|
|
42
|
-
|
|
66
|
+
## Compatibility
|
|
67
|
+
-------------------------------------------------------------------------------
|
|
68
|
+
|
|
69
|
+
below is the compatibility version matrix :
|
|
70
|
+
|
|
71
|
+
| melonJS | @melonjs/spine-plugin | spine-runtime |
|
|
72
|
+
|---|---|---|
|
|
73
|
+
| v15.12.x (or higher) | v1.x | v4.1, v4.2-beta |
|
|
74
|
+
|
|
75
|
+
>Note: the current version of the spine-plugin is bundled with the 4.2.x beta version of the Spine runtime, which is for now backward compatible with the Spine 4.1 runtime (from a player/rendering point of view).
|
|
76
|
+
|
|
77
|
+
## Questions, need help ?
|
|
43
78
|
-------------------------------------------------------------------------------
|
|
44
79
|
If you need technical support, you can contact us through the following channels :
|
|
45
80
|
* Forums: with melonJS 2 we moved to a new discourse [forum](https://melonjs.discourse.group), but we can still also find the previous one [here](http://www.html5gamedevs.com/forum/32-melonjs/)
|