Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raylib 4.5 #6

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

joseph-montanez
Copy link

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" />

@ianharrigan
Copy link
Member

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
Copy link
Author

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
Copy link
Member

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
Copy link

Mylab6 commented Sep 8, 2024

Hi Ian ?

Any hope to see an update to Raylib 5 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants