HaxeFlixel / flixel

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

Fix `null` text alignment returning as CENTER on HashLink #3196

Closed Starmapo closed 2 days ago

Starmapo commented 3 days ago

While working on the new text input, I found out that when compiling to HashLink, FlxText's align would return CENTER by default (not having changed it manually), instead of LEFT. This seems to be caused by the switch statement in FlxTextAlign.fromOpenFL() treating the null value as a 0, which corresponds to CENTER in OpenFL's text alignment enum (which is an abstract for Int).

This PR simply adds a null check in the function, which makes it automatically return LEFT if a null alignment was passed in.

Geokureli commented 2 days ago

made an issue for this, here: https://github.com/HaxeFoundation/hashlink/issues/696

Geokureli commented 2 days ago

Thanks!