mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[haxe] Apply fixes to target hl (HashLink).
This commit is contained in:
parent
c0b34b9530
commit
88b374a9a1
@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
package;
|
package;
|
||||||
|
|
||||||
|
import openfl.events.Event;
|
||||||
|
import starling.events.Event as StarlingEvent;
|
||||||
import flixelExamples.FlixelState;
|
import flixelExamples.FlixelState;
|
||||||
import starlingExamples.BasicExample;
|
import starlingExamples.BasicExample;
|
||||||
import starlingExamples.Scene.SceneManager;
|
import starlingExamples.Scene.SceneManager;
|
||||||
@ -40,7 +42,6 @@ import openfl.text.TextField;
|
|||||||
import openfl.text.TextFormat;
|
import openfl.text.TextFormat;
|
||||||
import openfl.events.MouseEvent;
|
import openfl.events.MouseEvent;
|
||||||
import openfl.geom.Rectangle;
|
import openfl.geom.Rectangle;
|
||||||
import starling.events.Event;
|
|
||||||
|
|
||||||
class Main extends Sprite {
|
class Main extends Sprite {
|
||||||
private var background:Sprite;
|
private var background:Sprite;
|
||||||
@ -160,13 +161,15 @@ class Main extends Sprite {
|
|||||||
trace("Launching Starling game");
|
trace("Launching Starling game");
|
||||||
starlingSingleton = new Starling(starling.display.Sprite, stage, new Rectangle(0, 0, 800, 600));
|
starlingSingleton = new Starling(starling.display.Sprite, stage, new Rectangle(0, 0, 800, 600));
|
||||||
starlingSingleton.supportHighResolutions = true;
|
starlingSingleton.supportHighResolutions = true;
|
||||||
starlingSingleton.addEventListener(Event.ROOT_CREATED, onStarlingRootCreated);
|
starlingSingleton.addEventListener(StarlingEvent.ROOT_CREATED, onStarlingRootCreated);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function onStarlingRootCreated(event:Event):Void {
|
private function onStarlingRootCreated(event:StarlingEvent):Void {
|
||||||
destroyUI();
|
destroyUI();
|
||||||
starlingSingleton.removeEventListener(Event.ROOT_CREATED, onStarlingRootCreated);
|
starlingSingleton.removeEventListener(StarlingEvent.ROOT_CREATED, onStarlingRootCreated);
|
||||||
starlingSingleton.start();
|
starlingSingleton.start();
|
||||||
|
Starling.current.stage.stageWidth = 800;
|
||||||
|
Starling.current.stage.stageHeight = 600;
|
||||||
Starling.current.stage.color = 0x000000;
|
Starling.current.stage.color = 0x000000;
|
||||||
|
|
||||||
SceneManager.getInstance().switchScene(new BasicExample());
|
SceneManager.getInstance().switchScene(new BasicExample());
|
||||||
|
|||||||
@ -190,7 +190,7 @@ class FlixelState extends FlxState {
|
|||||||
// FlxG.debugger.visible = !FlxG.debugger.visible;
|
// FlxG.debugger.visible = !FlxG.debugger.visible;
|
||||||
// debug ui
|
// debug ui
|
||||||
// FlxG.debugger.visible = true;
|
// FlxG.debugger.visible = true;
|
||||||
FlxG.debugger.drawDebug = true;
|
// FlxG.debugger.drawDebug = true;
|
||||||
// FlxG.log.redirectTraces = true;
|
// FlxG.log.redirectTraces = true;
|
||||||
|
|
||||||
// FlxG.debugger.track(spineSprite);
|
// FlxG.debugger.track(spineSprite);
|
||||||
|
|||||||
@ -180,7 +180,7 @@ class Skeleton {
|
|||||||
for (c in constraints) {
|
for (c in constraints) {
|
||||||
var constraint:Constraint<Dynamic, Dynamic, Dynamic> = c;
|
var constraint:Constraint<Dynamic, Dynamic, Dynamic> = c;
|
||||||
constraint.active = constraint.isSourceActive()
|
constraint.active = constraint.isSourceActive()
|
||||||
&& (!constraint.data.skinRequired || (skin != null && contains(skin.constraints, constraint.data)));
|
&& (!constraint.data.skinRequired || (skin != null && contains(skin.constraints, cast constraint.data)));
|
||||||
if (constraint.active)
|
if (constraint.active)
|
||||||
constraint.sort(this);
|
constraint.sort(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -598,7 +598,7 @@ class SkeletonBinary {
|
|||||||
region.height = height * scale;
|
region.height = height * scale;
|
||||||
region.color.setFromRgba8888(color);
|
region.color.setFromRgba8888(color);
|
||||||
region.sequence = sequence;
|
region.sequence = sequence;
|
||||||
if (region.region == null)
|
if (region.region != null)
|
||||||
region.updateRegion();
|
region.updateRegion();
|
||||||
return region;
|
return region;
|
||||||
case AttachmentType.boundingbox:
|
case AttachmentType.boundingbox:
|
||||||
@ -643,7 +643,7 @@ class SkeletonBinary {
|
|||||||
mesh.worldVerticesLength = vertices.length;
|
mesh.worldVerticesLength = vertices.length;
|
||||||
mesh.triangles = triangles;
|
mesh.triangles = triangles;
|
||||||
mesh.regionUVs = uvs;
|
mesh.regionUVs = uvs;
|
||||||
if (mesh.region == null)
|
if (mesh.region != null)
|
||||||
mesh.updateRegion();
|
mesh.updateRegion();
|
||||||
mesh.hullLength = hullLength << 1;
|
mesh.hullLength = hullLength << 1;
|
||||||
mesh.sequence = sequence;
|
mesh.sequence = sequence;
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
package spine;
|
package spine;
|
||||||
|
|
||||||
|
import haxe.DynamicAccess;
|
||||||
import spine.animation.BoneTimeline2;
|
import spine.animation.BoneTimeline2;
|
||||||
import spine.animation.SliderMixTimeline;
|
import spine.animation.SliderMixTimeline;
|
||||||
import spine.animation.SliderTimeline;
|
import spine.animation.SliderTimeline;
|
||||||
@ -504,7 +505,7 @@ class SkeletonJson {
|
|||||||
// Events.
|
// Events.
|
||||||
var events:Dynamic = Reflect.getProperty(root, "events");
|
var events:Dynamic = Reflect.getProperty(root, "events");
|
||||||
for (eventName in Reflect.fields(events)) {
|
for (eventName in Reflect.fields(events)) {
|
||||||
var eventMap:Map<String, Dynamic> = Reflect.field(events, eventName);
|
var eventMap:DynamicAccess<Dynamic> = Reflect.field(events, eventName);
|
||||||
var eventData:EventData = new EventData(eventName);
|
var eventData:EventData = new EventData(eventName);
|
||||||
eventData.intValue = getInt(eventMap, "int");
|
eventData.intValue = getInt(eventMap, "int");
|
||||||
eventData.floatValue = getFloat(eventMap, "float");
|
eventData.floatValue = getFloat(eventMap, "float");
|
||||||
@ -646,11 +647,10 @@ class SkeletonJson {
|
|||||||
return null;
|
return null;
|
||||||
path.closed = Reflect.hasField(map, "closed") ? cast(Reflect.field(map, "closed"), Bool) : false;
|
path.closed = Reflect.hasField(map, "closed") ? cast(Reflect.field(map, "closed"), Bool) : false;
|
||||||
path.constantSpeed = Reflect.hasField(map, "constantSpeed") ? cast(Reflect.field(map, "constantSpeed"), Bool) : true;
|
path.constantSpeed = Reflect.hasField(map, "constantSpeed") ? cast(Reflect.field(map, "constantSpeed"), Bool) : true;
|
||||||
var vertexCount:Int = getInt(map, "vertexCount", 0);
|
readVertices(map, path, getInt(map, "vertexCount", 0) << 1);
|
||||||
readVertices(map, path, vertexCount << 1);
|
|
||||||
var lengths:Array<Float> = new Array<Float>();
|
var lengths:Array<Float> = new Array<Float>();
|
||||||
for (curves in cast(Reflect.field(map, "lengths"), Array<Dynamic>)) {
|
for (curves in cast(Reflect.field(map, "lengths"), Array<Dynamic>)) {
|
||||||
lengths.push(Std.parseFloat(curves) * scale);
|
lengths.push(curves * scale);
|
||||||
}
|
}
|
||||||
path.lengths = lengths;
|
path.lengths = lengths;
|
||||||
return path;
|
return path;
|
||||||
@ -677,8 +677,7 @@ class SkeletonJson {
|
|||||||
throw new SpineException("Clipping end slot not found: " + end);
|
throw new SpineException("Clipping end slot not found: " + end);
|
||||||
clip.endSlot = slot;
|
clip.endSlot = slot;
|
||||||
}
|
}
|
||||||
var vertexCount:Int = getInt(map, "vertexCount", 0);
|
readVertices(map, clip, getInt(map, "vertexCount", 0) << 1);
|
||||||
readVertices(map, clip, vertexCount << 1);
|
|
||||||
color = Reflect.getProperty(map, "color");
|
color = Reflect.getProperty(map, "color");
|
||||||
if (color != null) {
|
if (color != null) {
|
||||||
clip.color.setFromString(color);
|
clip.color.setFromString(color);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user