pixijs / pixi-haxe

Externs of Pixi.js for Haxe
http://www.pixijs.com
MIT License
180 stars 65 forks source link

Settings Type Mismatch #146

Closed DanScott90 closed 7 years ago

DanScott90 commented 7 years ago

Hi, currently using latest 4.5.5 and have noticed a few type differences in some settings.

Haven't scoured over all settings, but ones I am intending to use are:

Settings.RETINA_PREFIX Settings.PRECISION setting with Pixi.Precisions

So Retina Prefix should be a RegExp: we can cast this at the moment. Settings.RETINA_PREFIX = cast new RegExp("scale-(.+)");

Trying to set Settings.PRECISION but using a magic var as consts seems mistyped and maybe misnamed. Pixi.Precisions.XXX should be a string, currently is an enum, maybe we can cast this extern to string? But also Pixi.Precisions is undefined for me, maybe it's named wrong, docs have same name but no "S" on the end. Looking at some older libraries this used to be a typedef where each member was a string.

DanScott90 commented 7 years ago

Also have just noticed that PIXI.settings.PRECISION is now deprecated.

Replaced by PIXI.settings.PRECISION_FRAGMENT PIXI.settings.PRECISION_VERTEX

Could these be added to a new version, was only needing to modify the Fragment setting anyway.

Thanks, Dan.

adireddy commented 7 years ago

should be good now.. delete and reinstall pixijs haxelib to check

DanScott90 commented 7 years ago

@adireddy Just a note on the RegEx, EReg actually didn't work for me, had to use the JS specific RegExp, EReg is missing exec function.

EReg is supposed to be the cross platform class, but not sure why it isn't working here, guess this is a haxe bug.

DanScott90 commented 7 years ago

And the precision vars maybe should type:Pixi.Precisions

But this const is broken for me, think the extern should be: @:native("PIXI.PRECISION") instead of @:native("PIXI.PRECISIONS")

adireddy commented 7 years ago

try again now changed EReg to js.RegEx and fixed PRECISION

DanScott90 commented 7 years ago

@adireddy RegEx good, Precision Extern now good.

If PRECISION_VERTEX & PRECISION_FRAGMENT could be changed from string to Precision as well would all be perfect?

Thanks.

adireddy commented 7 years ago

done 👍

DanScott90 commented 7 years ago

@adireddy Since last change, need to add import at top of Settings.hx file

import pixi.core.Pixi.Precision;

adireddy commented 7 years ago

:) this time I didn't compile

adireddy commented 7 years ago

should be fixed now

DanScott90 commented 7 years ago

Awesome, yep everything is perfect, thanks :)