foreignsasquatch / raylib-hx

Haxe bindings for raylib, a simple and easy-to-use library to learn videogame programming
https://raylib.com
zlib License
55 stars 13 forks source link

Wrap aliased RlColor in cpp.Struct #29

Closed jobf closed 1 year ago

jobf commented 1 year ago

I was seeing error: cannot convert ‘Dynamic’ to ‘Color’ when passing a Color as a constructor argument.

A helpful bit of info from the haxe discord -

constructor arguments must be "dynamic compatible" on hxcpp which externs representing native structs won't be, try wrapping the struct in a cpp.Struct for the constructor argument

This explains why there are lots of this in the bindings -

typedef Foo = cpp.Struct<Bar>;

e.g. as seen in the commit, this allows Color to be passed as a constructor argument -

typedef Color = cpp.Struct<RlColor>;