Generates target-agnostic Godot bindings for Haxe.
Most Godot binding generators for Haxe are built for a specific Haxe target (Haxe/C++, Haxe/C#, etc.) The goal of this project is to create generic bindings that can work as a base for other projects to avoid reinventing the wheel.
This is achieved by converting Godot's extension_api.json data to TypeDefinition representations of the generated Haxe types. From there, one can manipulate the TypeDefinitions to work best for their desired Haxe target. This project will then take care of generating the .hx files.
If you just want un-modified, basic Godot bindings, you can do that too!
First install via git.
haxelib git godot-api-generator https://github.com/SomeRanDev/Haxe-GodotBindingsGenerator
Next you can either generate basic bindings...
haxelib run godot-api-generator [path-to-json] [output-dir]
Or you can install the library and create your own generator.
| # | What to do | What to write |
|---|---|---|
| 1 | Add the lib to your .hxml file or compile command. |
-lib godot-api-generator |
| 2 | Get the TypeDefinitions and modify to your liking. |
final haxeTypes: Array<TypeDefinition> = godot.Bindings.generate("path-to-json"); |
| 3 | Output the bindings to a folder. | godot.Bindings.output("output-folder", haxeTypes); |
If you wish to include additional godot-cpp binding information such as @:includes and @:natives, add the --cpp flag or cpp option.
haxelib run godot-api-generator [path-to-json] [output-dir] --cpp
godot.Bindings.generate("path-to-json", { cpp: true });