diff --git a/spine-haxe/.vscode/launch.json b/spine-haxe/.vscode/launch.json
index 6c29a8961..09a92a9da 100644
--- a/spine-haxe/.vscode/launch.json
+++ b/spine-haxe/.vscode/launch.json
@@ -4,13 +4,6 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
- {
- "name": "web",
- "request": "launch",
- "type": "chrome",
- "url": "http://localhost:3000",
- "webRoot": "${workspaceFolder}"
- },
{
"name": "lime",
"type": "lime",
diff --git a/spine-haxe/example/src/BasicExample.hx b/spine-haxe/example/src/BasicExample.hx
index a332906df..6e29895fc 100644
--- a/spine-haxe/example/src/BasicExample.hx
+++ b/spine-haxe/example/src/BasicExample.hx
@@ -1,10 +1,7 @@
-import openfl.utils.Assets;
-import spine.SkeletonBinary;
+import openfl.geom.Rectangle;
import spine.SkeletonData;
-import spine.SkeletonJson;
import spine.animation.AnimationStateData;
import spine.atlas.TextureAtlas;
-import spine.attachments.AtlasAttachmentLoader;
import spine.starling.SkeletonSprite;
import starling.core.Starling;
@@ -18,8 +15,10 @@ class BasicExample extends Scene {
animationStateData.defaultMix = 0.25;
var skeletonSprite = new SkeletonSprite(skeletondata, animationStateData);
+ var bounds = skeletonSprite.skeleton.getBounds();
+ skeletonSprite.scale = Starling.current.stage.stageWidth / bounds.width * 0.5;
skeletonSprite.x = Starling.current.stage.stageWidth / 2;
- skeletonSprite.y = Starling.current.stage.stageHeight * 0.5;
+ skeletonSprite.y = Starling.current.stage.stageHeight * 0.9;
skeletonSprite.state.setAnimationByName(0, "walk", true);
diff --git a/spine-haxe/project.xml b/spine-haxe/project.xml
index 620685391..ceeafb6fb 100644
--- a/spine-haxe/project.xml
+++ b/spine-haxe/project.xml
@@ -11,5 +11,6 @@
+
\ No newline at end of file
diff --git a/spine-haxe/spine-haxe/spine/BinaryInput.hx b/spine-haxe/spine-haxe/spine/BinaryInput.hx
index fc9f0be43..149b5c6e4 100644
--- a/spine-haxe/spine-haxe/spine/BinaryInput.hx
+++ b/spine-haxe/spine-haxe/spine/BinaryInput.hx
@@ -76,7 +76,7 @@ class BinaryInput {
chars += String.fromCharCode(((b & 0x0F) << 12 | (readByte() & 0x3F) << 6 | readByte() & 0x3F));
i += 3;
default:
- chars += String.fromCharCode(b);
+ chars += String.fromCharCode(b & 0xff);
i++;
}
}
diff --git a/spine-haxe/spine-haxe/spine/Skeleton.hx b/spine-haxe/spine-haxe/spine/Skeleton.hx
index 80f567293..cfb55991c 100644
--- a/spine-haxe/spine-haxe/spine/Skeleton.hx
+++ b/spine-haxe/spine-haxe/spine/Skeleton.hx
@@ -1,5 +1,6 @@
package spine;
+import openfl.geom.Rectangle;
import openfl.errors.ArgumentError;
import openfl.utils.Dictionary;
import openfl.Vector;
@@ -561,11 +562,10 @@ class Skeleton {
return _data.name != null ? _data.name : "Skeleton?";
}
- public function getBounds(offset:Vector, size:Vector, temp:Vector):Void {
- if (offset == null)
- throw new ArgumentError("offset cannot be null.");
- if (size == null)
- throw new ArgumentError("size cannot be null.");
+ private var _tempVertices = new Vector();
+ private var _bounds = new Rectangle();
+
+ public function getBounds():Rectangle {
var minX:Float = Math.POSITIVE_INFINITY;
var minY:Float = Math.POSITIVE_INFINITY;
var maxX:Float = Math.NEGATIVE_INFINITY;
@@ -576,14 +576,14 @@ class Skeleton {
var attachment:Attachment = slot.attachment;
if (Std.isOfType(attachment, RegionAttachment)) {
verticesLength = 8;
- temp.length = verticesLength;
- vertices = temp;
+ _tempVertices.length = verticesLength;
+ vertices = _tempVertices;
cast(attachment, RegionAttachment).computeWorldVertices(slot, vertices, 0, 2);
} else if (Std.isOfType(attachment, MeshAttachment)) {
var mesh:MeshAttachment = cast(attachment, MeshAttachment);
verticesLength = mesh.worldVerticesLength;
- temp.length = verticesLength;
- vertices = temp;
+ _tempVertices.length = verticesLength;
+ vertices = _tempVertices;
mesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2);
}
if (vertices != null) {
@@ -599,9 +599,10 @@ class Skeleton {
}
}
}
- offset[0] = minX;
- offset[1] = minY;
- size[0] = maxX - minX;
- size[1] = maxY - minY;
+ _bounds.x = minX;
+ _bounds.y = minY;
+ _bounds.width = maxX - minX;
+ _bounds.height = maxY - minY;
+ return _bounds;
}
}