HaxeFlixel / flixel

Free, cross-platform 2D game engine powered by Haxe and OpenFL
https://haxeflixel.com/
MIT License
1.93k stars 427 forks source link

FlxColor.fromString problem - in cpp builds FlxColor.fromString/Std.parseInt can't deal with AARRGGBB values #3138

Open increpare opened 1 month ago

increpare commented 1 month ago

(warning: somewhat low-quality bug report - I figure it's better to point it out than to not say anything at all)

I'm on windows with haxe 4.3.4

https://github.com/HaxeFlixel/flixel/blob/fd3eff9bd10a52c4a33937446a230a3c5b680390/flixel/util/FlxColor.hx#L195

0xff112233 has the value 4279312947, but evaluating trace(Std.parseInt("0xff112233"));

we get I think the error code 2147483647 (0x7FFFFFFF)

(in a html5 build it works for me and gives 4279312947)

cf https://github.com/HaxeFoundation/haxe/issues/6759

I was able to work around it pretty easily in my use-case by dropping A values. I'm using a very out-of-date version of flixel right now (4.8.1), but for instance FlxColor.fromString("0xff112233").toHexString() evaluates to 0x7FFFFFFF in the cpp build. It doesn't seem the function has changed much since then.

Geokureli commented 1 month ago

I'll see if I can reproduce this on my mac, if not I have a windows pc I can try. there may be a workaround flixel can use but I wonder if haxe std should have a parseUInt or something

The issue you link seems different, though. 1. it compares android and linux, 2. it works fine on hex strings, just not on decimal.

Edit: I can't reproduce this issue on Mac with haxe 4.3.3. I'll report back after more testing

Geokureli commented 3 weeks ago

this seems related: https://github.com/HaxeFoundation/hxcpp/pull/1053 are you using hxcpp v 4.3.2? I believe this may be fixed in the next version. I don't see this on mac with haxe 4.3.4 and hxcpp 4.3.2, but other people are seeing it on windows