Skip to content

Commit

Permalink
RenderUtil: remove #if hl when handling String profiles
Browse files Browse the repository at this point in the history
It's better for the Haxe compiler to know that the value is a String instead of Dynamic when assigning to the Context3DProfile type, even if it may technically work with Dynamic on some profiles.
  • Loading branch information
joshtynjala committed Nov 10, 2023
1 parent 768ea1a commit 1f0d0b9
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/starling/utils/RenderUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,7 @@ class RenderUtil
else if (#if (haxe_ver < 4.2) Std.is #else Std.isOfType #end(profile, Int))
profiles = [cast profile];
else if (#if (haxe_ver < 4.2) Std.is #else Std.isOfType #end(profile, String))
#if hl
// for some reason on HashLink if you don't do that it will result in a 'Can't cast String to i32' error
profiles = [Std.string(profile)];
#else
profiles = [profile];
#end
else if (#if (haxe_ver < 4.2) Std.is #else Std.isOfType #end(profile, Array))
{
var dynProfiles:Array<Dynamic> = cast(profile, Array<Dynamic>);
Expand All @@ -254,12 +249,7 @@ class RenderUtil
}
else
{
#if hl
// for some reason on HashLink if you don't do that it will result in a 'Can't cast String to i32' error
profiles.push(Std.string(prof));
#else
profiles.push(prof);
#end
}
}
}
Expand Down Expand Up @@ -322,4 +312,4 @@ class RenderUtil

requestNextProfile();
}
}
}

0 comments on commit 1f0d0b9

Please sign in to comment.