haxeui / raylib-haxe

RayLib extern bindings for Haxe
MIT License
34 stars 4 forks source link

Raylib 4.5 #6

Open joseph-montanez opened 1 year ago

joseph-montanez commented 1 year ago

Added Raylib 4.5 support. Need to still test on Windows and Linux. Couple of Notes:

ianharrigan commented 1 year ago

Generating run.n is no longer completely automatic, array returns break and a few places with strings. So need to hand correct those.

Can you expand on this? Are you saying that the auto generation no longer works?

joseph-montanez commented 1 year ago

Sure, arrays seems to miss the mark when converted. i.e

extern class MaterialRef extends RayMaterial {
    public var shader(get, set):ShaderRef;
    private inline function get_shader():ShaderRef { return cast _shader; }
    private inline function set_shader(value:ShaderRef):ShaderRef { _shader = cast value; return value; }

    public var maps(get, set):cpp.RawPointer<MaterialMap>;
    private inline function get_maps():cpp.RawPointer<MaterialMap> { return cast _maps; }
    private inline function set_maps(value:cpp.RawPointer<MaterialMap>):cpp.RawPointer<MaterialMap> { _maps = cast value; return value; }

    public var params(get, set):float[4];
    private inline function get_params():float[4] { return cast _params; }
    private inline function set_params(value:float[4]):float[4] { _params = cast value; return value; }

}

Should be:

    public var params(get, set):Array<Float>;
    private inline function get_params():Array<Float> { return cast _params; }
    private inline function set_params(value:Array<Float>):Array<Float> { _params = cast value; return value; }

Previous it would generate:

    public var params(get, set):Float;
    private inline function get_params():Float { return  _params; }
    private inline function set_params(value:Float):Float { _params =  value; return value; }

So it may not have been correct previously either, but at least it still compiled. Currently generating the RayLib.hx will result in compiling errors due to the float[4]. Also char[32] needs to be converted to cpp.ConstCharStar (maybe I don't know the correct type conversion here). Then edge cases for non-primatives i.e Matrix[2] should be Array<Matrix>.

ianharrigan commented 1 year ago

Alright, sounds like a bug in the generator... ill merge this over the weekend and fix the generator, hand editing the generated .hx file isnt right, and defeats the purpose of the generation in the first place.

Thanks for finding it! :)

Cheers, Ian

Mylab6 commented 1 month ago

Hi Ian ?

Any hope to see an update to Raylib 5 ?