diff --git a/spine-libgdx/src/com/esotericsoftware/spine/Animation.java b/spine-libgdx/src/com/esotericsoftware/spine/Animation.java index 1dbc5217f..4ebb8813e 100644 --- a/spine-libgdx/src/com/esotericsoftware/spine/Animation.java +++ b/spine-libgdx/src/com/esotericsoftware/spine/Animation.java @@ -65,10 +65,11 @@ public class Animation { /** @deprecated */ public void apply (Skeleton skeleton, float time, boolean loop) { - apply(skeleton, Float.MAX_VALUE, time, loop, null); + apply(skeleton, time, time, loop, null); } /** Poses the skeleton at the specified time for this animation. + * @param lastTime The last time the animation was applied. Can be equal to time if events shouldn't be fired. * @param events Any triggered events are added. May be null if lastTime is known to not cause any events to trigger. */ public void apply (Skeleton skeleton, float lastTime, float time, boolean loop, Array events) { if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null."); @@ -85,12 +86,13 @@ public class Animation { /** @deprecated */ public void mix (Skeleton skeleton, float time, boolean loop, float alpha) { - mix(skeleton, Float.MAX_VALUE, time, loop, null, alpha); + mix(skeleton, time, time, loop, null, alpha); } /** Poses the skeleton at the specified time for this animation mixed with the current pose. - * @param alpha The amount of this animation that affects the current pose. - * @param events Any triggered events are added. May be null if lastTime is known to not cause any events to trigger. */ + * @param lastTime The last time the animation was applied. Can be equal to time if events shouldn't be fired. + * @param events Any triggered events are added. May be null if lastTime is known to not cause any events to trigger. + * @param alpha The amount of this animation that affects the current pose. */ public void mix (Skeleton skeleton, float lastTime, float time, boolean loop, Array events, float alpha) { if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null."); diff --git a/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java b/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java index 710749759..6f8ef3a08 100644 --- a/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java +++ b/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java @@ -86,7 +86,7 @@ public class AnimationState { events.clear(); if (previous != null) { - previous.apply(skeleton, Float.MAX_VALUE, previousTime, previousLoop, null); + previous.apply(skeleton, Integer.MAX_VALUE, previousTime, previousLoop, null); float alpha = mixTime / mixDuration; if (alpha >= 1) { alpha = 1; diff --git a/spine-libgdx/test/com/esotericsoftware/spine/SkeletonTest.java b/spine-libgdx/test/com/esotericsoftware/spine/SkeletonTest.java index 9994916be..5553dd5b5 100644 --- a/spine-libgdx/test/com/esotericsoftware/spine/SkeletonTest.java +++ b/spine-libgdx/test/com/esotericsoftware/spine/SkeletonTest.java @@ -65,7 +65,7 @@ public class SkeletonTest extends ApplicationAdapter { renderer = new SkeletonRenderer(); debugRenderer = new SkeletonRendererDebug(); - final String name = "spineboy"; // "spineboy"; + final String name = "goblins"; // "spineboy"; // A regular texture atlas would normally usually be used. This returns a white image for images not found in the atlas. Pixmap pixmap = new Pixmap(32, 32, Format.RGBA8888); @@ -93,7 +93,7 @@ public class SkeletonTest extends ApplicationAdapter { // binary.setScale(2); skeletonData = binary.readSkeletonData(Gdx.files.internal(name + ".skel")); } - animation = skeletonData.findAnimation("drawOrder"); + animation = skeletonData.findAnimation("walk"); skeleton = new Skeleton(skeletonData); if (name.equals("goblins")) skeleton.setSkin("goblin"); diff --git a/spine-libgdx/test/goblins.json b/spine-libgdx/test/goblins.json index cc7ceed77..a95064dcd 100644 --- a/spine-libgdx/test/goblins.json +++ b/spine-libgdx/test/goblins.json @@ -48,7 +48,7 @@ "bounding box": { "bbox": { "type": "boundingbox", - "points": [ + "vertices": [ -7.2252045, -34.808647, -1.9847412, @@ -101,7 +101,7 @@ "left upper leg": { "boundingbox": { "type": "boundingbox", - "points": [ -73.94766, 8.514406, -49.917465, 25.294191, -79.28125, 46.664314, -95.755325, 34.604897, -74.9664, 27.453112 ] + "vertices": [ -73.94766, 8.514406, -49.917465, 25.294191, -79.28125, 46.664314, -95.755325, 34.604897, -74.9664, 27.453112 ] } }, "right hand item": { diff --git a/spine-libgdx/test/spineboy.json b/spine-libgdx/test/spineboy.json index 3c75a8a1e..7619ab6b6 100644 --- a/spine-libgdx/test/spineboy.json +++ b/spine-libgdx/test/spineboy.json @@ -129,15 +129,15 @@ "head": { "rotate": [ { "time": 0, "angle": 0 }, - { "time": 0.4827, "angle": -11.07, "curve": "stepped" }, - { "time": 0.8965, "angle": -11.07 }, + { "time": 0.4827, "angle": -23.11 }, + { "time": 0.8965, "angle": -56.45 }, { "time": 1.3103, "angle": 1.38 }, - { "time": 1.7931, "angle": 12.91 }, + { "time": 1.7931, "angle": 36.12 }, { "time": 2.1379, "angle": 1.24 }, - { "time": 2.6206, "angle": -16.12, "curve": "stepped" }, - { "time": 3.3103, "angle": -16.12 }, - { "time": 3.6551, "angle": 1.31 }, - { "time": 4, "angle": 359.99 } + { "time": 2.6206, "angle": -37.12 }, + { "time": 2.9666, "angle": 2.07 }, + { "time": 3.4666, "angle": 34.72 }, + { "time": 3.9, "angle": 359.99 } ], "translate": [ { diff --git a/spine-xna/example/data/spineboy.json b/spine-xna/example/data/spineboy.json index 3c75a8a1e..7619ab6b6 100644 --- a/spine-xna/example/data/spineboy.json +++ b/spine-xna/example/data/spineboy.json @@ -129,15 +129,15 @@ "head": { "rotate": [ { "time": 0, "angle": 0 }, - { "time": 0.4827, "angle": -11.07, "curve": "stepped" }, - { "time": 0.8965, "angle": -11.07 }, + { "time": 0.4827, "angle": -23.11 }, + { "time": 0.8965, "angle": -56.45 }, { "time": 1.3103, "angle": 1.38 }, - { "time": 1.7931, "angle": 12.91 }, + { "time": 1.7931, "angle": 36.12 }, { "time": 2.1379, "angle": 1.24 }, - { "time": 2.6206, "angle": -16.12, "curve": "stepped" }, - { "time": 3.3103, "angle": -16.12 }, - { "time": 3.6551, "angle": 1.31 }, - { "time": 4, "angle": 359.99 } + { "time": 2.6206, "angle": -37.12 }, + { "time": 2.9666, "angle": 2.07 }, + { "time": 3.4666, "angle": 34.72 }, + { "time": 3.9, "angle": 359.99 } ], "translate": [ { diff --git a/spine-xna/example/src/ExampleGame.cs b/spine-xna/example/src/ExampleGame.cs index 5faadccb9..62168dfab 100644 --- a/spine-xna/example/src/ExampleGame.cs +++ b/spine-xna/example/src/ExampleGame.cs @@ -86,16 +86,19 @@ namespace Spine { } state = new AnimationState(stateData); - state.Start += new EventHandler(Start); - state.End += new EventHandler(End); - state.Complete += new EventHandler(Complete); - state.Event += new EventHandler(Event); if (true) { + // Event handling for all animations. + state.Start += new EventHandler(Start); + state.End += new EventHandler(End); + state.Complete += new EventHandler(Complete); + state.Event += new EventHandler(Event); + state.SetAnimation("drawOrder", true); } else { state.SetAnimation("walk", false); - state.AddAnimation("jump", false); + QueueEntry entry = state.AddAnimation("jump", false); + entry.End += new EventHandler(End); // Event handling for queued animations. state.AddAnimation("walk", true); } @@ -132,14 +135,13 @@ namespace Spine { bounds.Update(skeleton); MouseState mouse = Mouse.GetState(); + headSlot.G = 1; + headSlot.B = 1; if (bounds.AabbContainsPoint(mouse.X, mouse.Y)) { BoundingBoxAttachment hit = bounds.ContainsPoint(mouse.X, mouse.Y); if (hit != null) { headSlot.G = 0; headSlot.B = 0; - } else { - headSlot.G = 1; - headSlot.B = 1; } } @@ -147,19 +149,19 @@ namespace Spine { } public void Start (object sender, EventArgs e) { - Console.WriteLine("start"); + Console.WriteLine(state + ": start"); } public void End (object sender, EventArgs e) { - Console.WriteLine("end"); + Console.WriteLine(state + ": end"); } public void Complete (object sender, CompleteArgs e) { - Console.WriteLine("complete " + e.LoopCount); + Console.WriteLine(state + ": complete " + e.LoopCount); } public void Event (object sender, EventTriggeredArgs e) { - Console.WriteLine("event " + e.Event); + Console.WriteLine(state + ": event " + e.Event); } } }