diff --git a/examples/export/runtimes.sh b/examples/export/runtimes.sh index 082011794..186cd0f79 100755 --- a/examples/export/runtimes.sh +++ b/examples/export/runtimes.sh @@ -350,6 +350,10 @@ cp -f ../spineboy/export/spineboy-pro.skel "$ROOT/spine-ts/spine-phaser/example/ cp -f ../spineboy/export/spineboy-pma.atlas "$ROOT/spine-ts/spine-phaser/example/assets/" cp -f ../spineboy/export/spineboy-pma.png "$ROOT/spine-ts/spine-phaser/example/assets/" +cp -f ../coin/export/coin-pro.skel "$ROOT/spine-ts/spine-phaser/example/assets/" +cp -f ../coin/export/coin-pma.atlas "$ROOT/spine-ts/spine-phaser/example/assets/" +cp -f ../coin/export/coin-pma.png "$ROOT/spine-ts/spine-phaser/example/assets/" + echo "spine-monogame" rm "$ROOT/spine-monogame/spine-monogame-example/data/"* cp -f ../coin/export/coin-pro.json "$ROOT/spine-monogame/spine-monogame-example/data/" diff --git a/spine-ts/spine-phaser/example/arcade-physics-test.html b/spine-ts/spine-phaser/example/arcade-physics-test.html new file mode 100644 index 000000000..bb585db0f --- /dev/null +++ b/spine-ts/spine-phaser/example/arcade-physics-test.html @@ -0,0 +1,59 @@ + + + + + + + + + Spine Phaser Example + + +

Arcade Physics example

+ + + \ No newline at end of file diff --git a/spine-ts/spine-phaser/example/assets/coin-pma.atlas b/spine-ts/spine-phaser/example/assets/coin-pma.atlas new file mode 100644 index 000000000..290e1858d --- /dev/null +++ b/spine-ts/spine-phaser/example/assets/coin-pma.atlas @@ -0,0 +1,19 @@ +coin-pma.png + size: 1024, 1024 + filter: Linear, Linear + pma: true +coin-front-logo + bounds: 2, 570, 305, 302 +coin-front-shine-logo + bounds: 2, 286, 282, 282 +coin-front-shine-spineboy + bounds: 305, 283, 282, 282 +coin-front-spineboy + bounds: 309, 567, 305, 302 + rotate: 90 +coin-side-round + bounds: 2, 2, 144, 282 +coin-side-straight + bounds: 286, 286, 17, 282 +shine + bounds: 148, 39, 72, 245 diff --git a/spine-ts/spine-phaser/example/assets/coin-pma.png b/spine-ts/spine-phaser/example/assets/coin-pma.png new file mode 100644 index 000000000..93e97ded9 Binary files /dev/null and b/spine-ts/spine-phaser/example/assets/coin-pma.png differ diff --git a/spine-ts/spine-phaser/example/assets/coin-pro.skel b/spine-ts/spine-phaser/example/assets/coin-pro.skel new file mode 100644 index 000000000..eda3d9961 Binary files /dev/null and b/spine-ts/spine-phaser/example/assets/coin-pro.skel differ diff --git a/spine-ts/spine-phaser/example/blend-test.html b/spine-ts/spine-phaser/example/blend-test.html new file mode 100644 index 000000000..903b8e950 --- /dev/null +++ b/spine-ts/spine-phaser/example/blend-test.html @@ -0,0 +1,70 @@ + + + + + + + + + Spine Phaser Example + + +

Blend test

+ + + \ No newline at end of file diff --git a/spine-ts/spine-phaser/example/camera-pipeline-test.html b/spine-ts/spine-phaser/example/camera-pipeline-test.html new file mode 100644 index 000000000..c2fc4cb4a --- /dev/null +++ b/spine-ts/spine-phaser/example/camera-pipeline-test.html @@ -0,0 +1,113 @@ + + + + + + + + + + Spine Phaser Example + + + +

Camera pipeline test

+ + + + \ No newline at end of file diff --git a/spine-ts/spine-phaser/example/index.html b/spine-ts/spine-phaser/example/index.html index b15fdf427..30028af9c 100644 --- a/spine-ts/spine-phaser/example/index.html +++ b/spine-ts/spine-phaser/example/index.html @@ -15,6 +15,9 @@
  • Multi-scene test
  • Bounds test
  • Visibility test
  • +
  • Arcade physics example
  • +
  • Blend test
  • +
  • Camera pipeline test
  • \ No newline at end of file diff --git a/spine-ts/spine-phaser/src/SpineGameObject.ts b/spine-ts/spine-phaser/src/SpineGameObject.ts index a0d03d756..4011ecd3b 100644 --- a/spine-ts/spine-phaser/src/SpineGameObject.ts +++ b/spine-ts/spine-phaser/src/SpineGameObject.ts @@ -39,8 +39,8 @@ export class SkinsAndAnimationBoundsProvider implements SpineGameObjectBoundsPro const animationState = new AnimationState(gameObject.animationState.data); const skeleton = new Skeleton(gameObject.skeleton.data); const data = skeleton.data; - let customSkin = new Skin("custom-skin"); if (this.skins.length > 0) { + let customSkin = new Skin("custom-skin"); for (const skinName of this.skins) { const skin = data.findSkin(skinName); if (skin == null) continue; @@ -51,15 +51,11 @@ export class SkinsAndAnimationBoundsProvider implements SpineGameObjectBoundsPro skeleton.setToSetupPose(); const animation = this.animation != null ? data.findAnimation(this.animation!) : null; - let minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY; if (animation == null) { skeleton.updateWorldTransform(); - const bounds = skeleton.getBoundsRect(); - minX = bounds.x; - minY = bounds.y; - maxX = minX + bounds.width; - maxY = minY + bounds.height; + return skeleton.getBoundsRect(); } else { + let minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY; animationState.clearTracks(); animationState.setAnimationWith(0, animation, false); const steps = Math.max(animation.duration / this.timeStep, 1.0); @@ -74,8 +70,8 @@ export class SkinsAndAnimationBoundsProvider implements SpineGameObjectBoundsPro maxX = Math.max(maxX, minX + bounds.width); maxY = Math.max(maxY, minY + bounds.height); } + return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; } - return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; } }