diff --git a/spine-csharp/src/IkConstraint.cs b/spine-csharp/src/IkConstraint.cs
index c5ef77ea5..121869c3b 100644
--- a/spine-csharp/src/IkConstraint.cs
+++ b/spine-csharp/src/IkConstraint.cs
@@ -88,7 +88,7 @@ namespace Spine {
float id = 1 / (p.a * p.d - p.b * p.c);
float x = targetX - p.worldX, y = targetY - p.worldY;
float tx = (x * p.d - y * p.b) * id - bone.ax, ty = (y * p.a - x * p.c) * id - bone.ay;
- float rotationIK = MathUtils.Atan2(ty, tx) * MathUtils.RadDeg - bone.ashearX - bone.arotation;
+ float rotationIK = (float)Math.Atan2(ty, tx) * MathUtils.RadDeg - bone.ashearX - bone.arotation;
if (bone.ascaleX < 0) rotationIK += 180;
if (rotationIK > 180)
rotationIK -= 360;
@@ -157,12 +157,12 @@ namespace Spine {
else if (cos > 1) cos = 1;
a2 = (float)Math.Acos(cos) * bendDir;
a = l1 + l2 * cos;
- b = l2 * MathUtils.Sin(a2);
- a1 = MathUtils.Atan2(ty * a - tx * b, tx * a + ty * b);
+ b = l2 * (float)Math.Sin(a2);
+ a1 = (float)Math.Atan2(ty * a - tx * b, tx * a + ty * b);
} else {
a = psx * l2;
b = psy * l2;
- float aa = a * a, bb = b * b, dd = tx * tx + ty * ty, ta = MathUtils.Atan2(ty, tx);
+ float aa = a * a, bb = b * b, dd = tx * tx + ty * ty, ta = (float)Math.Atan2(ty, tx);
c = bb * l1 * l1 + aa * dd - aa * bb;
float c1 = -2 * bb * l1, c2 = bb - aa;
d = c1 * c1 - 4 * c2 * c;
@@ -174,8 +174,8 @@ namespace Spine {
float r = Math.Abs(r0) < Math.Abs(r1) ? r0 : r1;
if (r * r <= dd) {
y = (float)Math.Sqrt(dd - r * r) * bendDir;
- a1 = ta - MathUtils.Atan2(y, r);
- a2 = MathUtils.Atan2(y / psy, (r - l1) / psx);
+ a1 = ta - (float)Math.Atan2(y, r);
+ a2 = (float)Math.Atan2(y / psy, (r - l1) / psx);
goto outer;
}
}
@@ -191,13 +191,13 @@ namespace Spine {
x = l1 - a;
d = x * x;
if (d < minDist) {
- minAngle = MathUtils.PI;
+ minAngle = (float)Math.PI;
minDist = d;
minX = x;
}
float angle = (float)Math.Acos(-a * l1 / (aa - bb));
- x = a * MathUtils.Cos(angle) + l1;
- y = b * MathUtils.Sin(angle);
+ x = a * (float)Math.Cos(angle) + l1;
+ y = b * (float)Math.Sin(angle);
d = x * x + y * y;
if (d < minDist) {
minAngle = angle;
@@ -212,15 +212,15 @@ namespace Spine {
maxY = y;
}
if (dd <= (minDist + maxDist) / 2) {
- a1 = ta - MathUtils.Atan2(minY * bendDir, minX);
+ a1 = ta - (float)Math.Atan2(minY * bendDir, minX);
a2 = minAngle * bendDir;
} else {
- a1 = ta - MathUtils.Atan2(maxY * bendDir, maxX);
+ a1 = ta - (float)Math.Atan2(maxY * bendDir, maxX);
a2 = maxAngle * bendDir;
}
}
outer:
- float os = MathUtils.Atan2(cy, cx) * s2;
+ float os = (float)Math.Atan2(cy, cx) * s2;
float rotation = parent.arotation;
a1 = (a1 - os) * MathUtils.RadDeg + os1 - rotation;
if (a1 > 180)
diff --git a/spine-libgdx/README.md b/spine-libgdx/README.md
index 6214553fb..b9d3a0544 100644
--- a/spine-libgdx/README.md
+++ b/spine-libgdx/README.md
@@ -27,6 +27,63 @@ Alternatively, the contents of the `spine-libgdx/src` directory can be copied in
* spine-libgdx depends on the gdx-backend-lwjgl project so the tests can easily be run on the desktop. If the tests are excluded, spine-libgdx only needs to depend on the gdx project.
* spine-libgdx depends on the gdx-box2d extension project solely for the `Box2DExample` test.
+## Maven & Gradle
+The spine-libgdx runtime is released to Maven Central through SonaType. We also deploy snapshot builds on every commit to the master repository. You can find the Jenkins build [here](http://libgdx.badlogicgames.com:8080/job/spine-libgdx/).
+
+### Versions
+
+You can find the latest version for release builds [here](http://search.maven.org/#search%7Cga%7C1%7Cspine-libgdx).
+
+You can find the latest SNAPSHOT version in the project's [pom.xml](https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-libgdx/spine-libgdx/pom.xml#L13).
+
+If you want to use a different branch, e.g. `3.6-beta`, build the artifact locally:
+
+```
+cd spine-libgdx/spine-libgdx
+mvn install
+```
+
+The version number is composed of the editor number at the time of release of the Maven artifact plus a patch number at the end. E.g. `3.5.51.3` means editor version `3.5.51`, and patch version `3` for the runtime. The editor version is updated everytime a new editor release is performed, the patch version is updated everytime a new fix or enhancement is released in the runtime.
+
+
+### Maven
+To add the spine-libgdx runtime to your Maven project, add this dependency:
+
+```
+
+ com.esotericsoftware.spine
+ spine-libgdx
+ 3.5.51.1
+
+```
+
+For SNAPSHOT versions, add the SonaType Snapshot repository to your `pom.xml`:
+
+```
+
+
+ nightlies
+ https://oss.sonatype.org/content/repositories/snapshots/
+
+
+```
+
+### Gradle
+To add the spine-libgdx runtime to your libGDX Gradle project, add the following dependencies to the `core` project in the `build.gradle` file at the root of your libGDX project:
+
+```
+project(":core") {
+ apply plugin: "java"
+
+ dependencies {
+ compile "com.badlogicgames.gdx:gdx:$gdxVersion"
+ compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
+
+ compile "com.esotericsoftware.spine:spine-libgdx:3.5.51.1"
+ }
+}
+```
+
## Examples
* [HTML5 example](http://esotericsoftware.com/files/runtimes/spine-libgdx/raptor/)
diff --git a/spine-libgdx/spine-libgdx/pom.xml b/spine-libgdx/spine-libgdx/pom.xml
new file mode 100644
index 000000000..b902c0f0c
--- /dev/null
+++ b/spine-libgdx/spine-libgdx/pom.xml
@@ -0,0 +1,120 @@
+
+
+ 4.0.0
+
+ org.sonatype.oss
+ oss-parent
+ 5
+
+
+ com.esotericsoftware.spine
+ spine-libgdx
+ jar
+ 3.5.51.2-SNAPSHOT
+
+ spine-libgdx
+ Spine Runtime for libGDX
+ http://github.com/esotericsoftware/spine-runtimes
+
+ http://github.com/esotericsoftware/spine-runtimes/issues
+
+
+
+
+ Spine Runtime License v2.5
+ https://github.com/EsotericSoftware/spine-runtimes/blob/master/LICENSE
+ repo
+
+
+
+
+
+ Developers
+ https://github.com/EsotericSoftware/spine-runtimes/graphs/contributors
+
+
+
+
+ scm:git:https://github.com/EsotericSoftware/spine-runtimes.git
+ scm:git:https://github.com/EsotericSoftware/spine-runtimes.git
+ https://github.com/EsotericSoftware/spine-runtimes/
+ HEAD
+
+
+
+
+ nightlies
+ https://oss.sonatype.org/content/repositories/snapshots/
+
+
+
+
+ UTF-8
+ 1.9.6
+
+
+
+ src
+ test
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ attach-sources
+ generate-resources
+
+ jar-no-fork
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.1
+
+ 1.6
+ 1.6
+ true
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+ -Xdoclint:none
+ false
+
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ 2.5.3
+
+
+ default
+
+ perform
+
+
+ spine-libgdx/spine-libgdx/pom.xml
+
+
+
+
+
+
+
+
+
+ com.badlogicgames.gdx
+ gdx
+ ${gdx.version}
+ compile
+ true
+
+
+
\ No newline at end of file
diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java
index 17f72db89..319b7e943 100644
--- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java
+++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java
@@ -30,7 +30,7 @@
package com.esotericsoftware.spine;
-import static com.badlogic.gdx.math.MathUtils.*;
+import static com.esotericsoftware.spine.utils.TrigUtils.*;
import static com.badlogic.gdx.math.Matrix3.*;
import com.badlogic.gdx.math.Matrix3;
diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java
index 36a5c9a1e..4929cd9f4 100644
--- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java
+++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java
@@ -30,7 +30,7 @@
package com.esotericsoftware.spine;
-import static com.badlogic.gdx.math.MathUtils.*;
+import static com.esotericsoftware.spine.utils.TrigUtils.*;
import com.badlogic.gdx.utils.Array;
diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java
index 06cde4795..582db4387 100644
--- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java
+++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java
@@ -30,7 +30,6 @@
package com.esotericsoftware.spine;
-import static com.badlogic.gdx.math.MathUtils.*;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.FloatArray;
@@ -39,6 +38,7 @@ import com.esotericsoftware.spine.PathConstraintData.RotateMode;
import com.esotericsoftware.spine.PathConstraintData.SpacingMode;
import com.esotericsoftware.spine.attachments.Attachment;
import com.esotericsoftware.spine.attachments.PathAttachment;
+import com.esotericsoftware.spine.utils.TrigUtils;
/** Stores the current pose for a path constraint. A path constraint adjusts the rotation, translation, and scale of the
* constrained bones so they follow a {@link PathAttachment}.
@@ -131,7 +131,7 @@ public class PathConstraint implements Constraint {
else {
tip = false;
Bone p = target.bone;
- offsetRotation *= p.a * p.d - p.b * p.c > 0 ? degRad : -degRad;
+ offsetRotation *= p.a * p.d - p.b * p.c > 0 ? TrigUtils.degRad : -TrigUtils.degRad;
}
for (int i = 0, p = 3; i < boneCount; i++, p += 3) {
Bone bone = (Bone)bones[i];
@@ -155,23 +155,23 @@ public class PathConstraint implements Constraint {
else if (spaces[i + 1] == 0)
r = positions[p + 2];
else
- r = atan2(dy, dx);
- r -= atan2(c, a);
+ r = (float)Math.atan2(dy, dx);
+ r -= (float)Math.atan2(c, a);
if (tip) {
- cos = cos(r);
- sin = sin(r);
+ cos = (float)Math.cos(r);
+ sin = (float)Math.sin(r);
float length = bone.data.length;
boneX += (length * (cos * a - sin * c) - dx) * rotateMix;
boneY += (length * (sin * a + cos * c) - dy) * rotateMix;
} else
r += offsetRotation;
- if (r > PI)
- r -= PI2;
- else if (r < -PI) //
- r += PI2;
+ if (r > TrigUtils.PI)
+ r -= TrigUtils.PI2;
+ else if (r < -TrigUtils.PI) //
+ r += TrigUtils.PI2;
r *= rotateMix;
- cos = cos(r);
- sin = sin(r);
+ cos = (float)Math.cos(r);
+ sin = (float)Math.sin(r);
bone.a = cos * a - sin * c;
bone.b = cos * b - sin * d;
bone.c = sin * a + cos * c;
@@ -399,16 +399,16 @@ public class PathConstraint implements Constraint {
}
private void addBeforePosition (float p, float[] temp, int i, float[] out, int o) {
- float x1 = temp[i], y1 = temp[i + 1], dx = temp[i + 2] - x1, dy = temp[i + 3] - y1, r = atan2(dy, dx);
- out[o] = x1 + p * cos(r);
- out[o + 1] = y1 + p * sin(r);
+ float x1 = temp[i], y1 = temp[i + 1], dx = temp[i + 2] - x1, dy = temp[i + 3] - y1, r = (float)Math.atan2(dy, dx);
+ out[o] = x1 + p * (float)Math.cos(r);
+ out[o + 1] = y1 + p * (float)Math.sin(r);
out[o + 2] = r;
}
private void addAfterPosition (float p, float[] temp, int i, float[] out, int o) {
- float x1 = temp[i + 2], y1 = temp[i + 3], dx = x1 - temp[i], dy = y1 - temp[i + 1], r = atan2(dy, dx);
- out[o] = x1 + p * cos(r);
- out[o + 1] = y1 + p * sin(r);
+ float x1 = temp[i + 2], y1 = temp[i + 3], dx = x1 - temp[i], dy = y1 - temp[i + 1], r = (float)Math.atan2(dy, dx);
+ out[o] = x1 + p * (float)Math.cos(r);
+ out[o + 1] = y1 + p * (float)Math.sin(r);
out[o + 2] = r;
}
@@ -420,7 +420,7 @@ public class PathConstraint implements Constraint {
float x = x1 * uuu + cx1 * uut3 + cx2 * utt3 + x2 * ttt, y = y1 * uuu + cy1 * uut3 + cy2 * utt3 + y2 * ttt;
out[o] = x;
out[o + 1] = y;
- if (tangents) out[o + 2] = atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
+ if (tangents) out[o + 2] = (float)Math.atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
}
public int getOrder () {
diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java
index 2d1add655..67e0376f6 100644
--- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java
+++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java
@@ -30,7 +30,7 @@
package com.esotericsoftware.spine;
-import static com.badlogic.gdx.math.MathUtils.*;
+import static com.esotericsoftware.spine.utils.TrigUtils.*;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/RegionAttachment.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/RegionAttachment.java
index db2d5c28a..44abe4722 100644
--- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/RegionAttachment.java
+++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/RegionAttachment.java
@@ -89,8 +89,8 @@ public class RegionAttachment extends Attachment {
localX2 *= scaleX;
localY2 *= scaleY;
float rotation = getRotation();
- float cos = MathUtils.cosDeg(rotation);
- float sin = MathUtils.sinDeg(rotation);
+ float cos = (float)Math.cos(MathUtils.degRad * rotation);
+ float sin = (float)Math.sin(MathUtils.degRad * rotation);
float x = getX();
float y = getY();
float localXCos = localX * cos + x;
diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/TrigUtils.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/TrigUtils.java
new file mode 100644
index 000000000..581d56794
--- /dev/null
+++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/TrigUtils.java
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * Spine Runtimes Software License v2.5
+ *
+ * Copyright (c) 2013-2016, Esoteric Software
+ * All rights reserved.
+ *
+ * You are granted a perpetual, non-exclusive, non-sublicensable, and
+ * non-transferable license to use, install, execute, and perform the Spine
+ * Runtimes software and derivative works solely for personal or internal
+ * use. Without the written permission of Esoteric Software (see Section 2 of
+ * the Spine Software License Agreement), you may not (a) modify, translate,
+ * adapt, or develop new applications using the Spine Runtimes or otherwise
+ * create derivative works or improvements of the Spine Runtimes or (b) remove,
+ * delete, alter, or obscure any trademarks or any copyright, trademark, patent,
+ * or other intellectual property or proprietary rights notices on or in the
+ * Software, including any copy thereof. Redistributions in binary or source
+ * form must include this license and terms.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
+ * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *****************************************************************************/
+
+package com.esotericsoftware.spine.utils;
+
+public class TrigUtils {
+ static public final float PI = 3.1415927f;
+ static public final float PI2 = PI * 2;
+ static public final float radiansToDegrees = 180f / PI;
+ static public final float radDeg = radiansToDegrees;
+ static public final float degreesToRadians = PI / 180;
+ static public final float degRad = degreesToRadians;
+
+ public static float cosDeg(float angle) {
+ return (float)Math.cos(angle * degRad);
+ }
+
+ public static float sinDeg(float angle) {
+ return (float)Math.sin(angle * degRad);
+ }
+
+ public static float cos(float angle) {
+ return (float)Math.cos(angle);
+ }
+
+ public static float sin(float angle) {
+ return (float)Math.sin(angle);
+ }
+
+ public static float atan2(float y, float x) {
+ return (float)Math.atan2(y, x);
+ }
+}
diff --git a/spine-ts/widget/example/index.html b/spine-ts/widget/example/index.html
index cca3009c4..a7f139b3e 100644
--- a/spine-ts/widget/example/index.html
+++ b/spine-ts/widget/example/index.html
@@ -81,7 +81,7 @@ new spine.SpineWidget("spine-widget", {
var animIndex = 0;
widget.canvas.onclick = function () {
animIndex++;
- let animations = widget.skeleton.data.animations;
+ var animations = widget.skeleton.data.animations;
if (animIndex >= animations.length) animIndex = 0;
widget.setAnimation(animations[animIndex].name);
}