[haxe] Apply fixes to target hl (HashLink).

This commit is contained in:
Davide Tantillo 2025-11-27 16:30:30 +01:00
parent c0b34b9530
commit 88b374a9a1
5 changed files with 16 additions and 14 deletions

View File

@ -29,6 +29,8 @@
package;
import openfl.events.Event;
import starling.events.Event as StarlingEvent;
import flixelExamples.FlixelState;
import starlingExamples.BasicExample;
import starlingExamples.Scene.SceneManager;
@ -40,7 +42,6 @@ import openfl.text.TextField;
import openfl.text.TextFormat;
import openfl.events.MouseEvent;
import openfl.geom.Rectangle;
import starling.events.Event;
class Main extends Sprite {
private var background:Sprite;
@ -160,13 +161,15 @@ class Main extends Sprite {
trace("Launching Starling game");
starlingSingleton = new Starling(starling.display.Sprite, stage, new Rectangle(0, 0, 800, 600));
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();
starlingSingleton.removeEventListener(Event.ROOT_CREATED, onStarlingRootCreated);
starlingSingleton.removeEventListener(StarlingEvent.ROOT_CREATED, onStarlingRootCreated);
starlingSingleton.start();
Starling.current.stage.stageWidth = 800;
Starling.current.stage.stageHeight = 600;
Starling.current.stage.color = 0x000000;
SceneManager.getInstance().switchScene(new BasicExample());

View File

@ -190,7 +190,7 @@ class FlixelState extends FlxState {
// FlxG.debugger.visible = !FlxG.debugger.visible;
// debug ui
// FlxG.debugger.visible = true;
FlxG.debugger.drawDebug = true;
// FlxG.debugger.drawDebug = true;
// FlxG.log.redirectTraces = true;
// FlxG.debugger.track(spineSprite);

View File

@ -180,7 +180,7 @@ class Skeleton {
for (c in constraints) {
var constraint:Constraint<Dynamic, Dynamic, Dynamic> = c;
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)
constraint.sort(this);
}

View File

@ -598,7 +598,7 @@ class SkeletonBinary {
region.height = height * scale;
region.color.setFromRgba8888(color);
region.sequence = sequence;
if (region.region == null)
if (region.region != null)
region.updateRegion();
return region;
case AttachmentType.boundingbox:
@ -643,7 +643,7 @@ class SkeletonBinary {
mesh.worldVerticesLength = vertices.length;
mesh.triangles = triangles;
mesh.regionUVs = uvs;
if (mesh.region == null)
if (mesh.region != null)
mesh.updateRegion();
mesh.hullLength = hullLength << 1;
mesh.sequence = sequence;

View File

@ -29,6 +29,7 @@
package spine;
import haxe.DynamicAccess;
import spine.animation.BoneTimeline2;
import spine.animation.SliderMixTimeline;
import spine.animation.SliderTimeline;
@ -504,7 +505,7 @@ class SkeletonJson {
// Events.
var events:Dynamic = Reflect.getProperty(root, "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);
eventData.intValue = getInt(eventMap, "int");
eventData.floatValue = getFloat(eventMap, "float");
@ -646,11 +647,10 @@ class SkeletonJson {
return null;
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;
var vertexCount:Int = getInt(map, "vertexCount", 0);
readVertices(map, path, vertexCount << 1);
readVertices(map, path, getInt(map, "vertexCount", 0) << 1);
var lengths:Array<Float> = new Array<Float>();
for (curves in cast(Reflect.field(map, "lengths"), Array<Dynamic>)) {
lengths.push(Std.parseFloat(curves) * scale);
lengths.push(curves * scale);
}
path.lengths = lengths;
return path;
@ -677,8 +677,7 @@ class SkeletonJson {
throw new SpineException("Clipping end slot not found: " + end);
clip.endSlot = slot;
}
var vertexCount:Int = getInt(map, "vertexCount", 0);
readVertices(map, clip, vertexCount << 1);
readVertices(map, clip, getInt(map, "vertexCount", 0) << 1);
color = Reflect.getProperty(map, "color");
if (color != null) {
clip.color.setFromString(color);