raylib-haxe icon indicating copy to clipboard operation
raylib-haxe copied to clipboard

Raylib 4.5

Open joseph-montanez opened this issue 11 months ago • 3 comments

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

  • Generating run.n is no longer completely automatic, array returns break and a few places with strings. So need to hand correct those.
  • I've not tested this on Windows or Linux yet, which may fail because of the GLFW update needed two additional files added to the compiler in Build.xml:
            <file name="${glfw_folder}/src/platform.c" />
            <file name="${glfw_folder}/src/posix_module.c" />

joseph-montanez avatar Aug 17 '23 10:08 joseph-montanez

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?

ianharrigan avatar Aug 17 '23 10:08 ianharrigan

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>.

joseph-montanez avatar Aug 17 '23 14:08 joseph-montanez

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

ianharrigan avatar Aug 18 '23 09:08 ianharrigan