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

FlxMath type parameters #3100

Closed VMan-2002 closed 2 months ago

VMan-2002 commented 2 months ago

Add type parameters in FlxMath functions so they can use both Int and Float

VMan-2002 commented 2 months ago

okay this would need to be figured out

public static function maxAdd<T:(Float & Int)>(value:T, amount:T, max:T, ?min:T = 0):T
                                                                                  ^ here

this error appears a few times, where a default value is unable to fit all available types. idk how to fix this or if it even is fixable

Geokureli commented 2 months ago

please test your code before making PRs the syntax you're trying is not valid also this is a breaking change for very little benefit