Import Dependencies specified in game.project file using Haxe
I'm using Rive dependency inside my Defold project but I don't know how to import these dependencies inside my Haxe file
You need to implement Haxe externs that cover the Rive API: https://defold.com/extension-rive/api/
The discussion in #27 should be useful for you. There I also provide examples on how to prepare externs for Defold extensions, as well as how to use them.
If anything is unclear let me know 😄
Can't we make a these extern into a package and distribute them through a registry ?
So that ensures central place for Haxe supported packages
It might be a good idea to make a new haxelib (e.g hxdefold-extensions) and provide externs there for all the "official" extensions that are documented with the rest of the Defold API.
However I probably won't have the time to get started on that soon.
Could you guide me on how to do it ?
I do have the time to release it
Is haxe have some kind of registry like java and kotlin (maven cetral repo) ?
I Uploaded the Rive extern package to haxelib: https://lib.haxe.org/p/rive-haxe/
and also the source code is open-source: https://github.com/ABDERRAHMANE-OUALI/rive-defold-haxe
Hello, thanks for contributing to Haxe!
Two notes about your implementation:
- Why did you define the
Selftype with arun()method? Typically in the Defold API, wherever you seeselfit usually implies the properties type of the calling object. For this reason, we tend to define these methods as generic. See for the example how we defined the Go.animate() method. - In your
haxelib.json, it might be a good idea to addhxdefoldas a dependency. (see here)
Despite that, I resumed work on a tool which will automatically parse the Defold documentation and generate Haxe externs. When that's done, I will prepare a new haxelib which will be a collection of Defold library externs. When that's done you can contribute to it as you want :)
Sounds good, thank you for you efforts
On Mon, Oct 17, 2022, 8:52 AM Haath @.***> wrote:
Hello, thanks for contributing to Haxe!
Two notes about your implementation:
- Why did you define the Self type with a run() method? Typically in the Defold API, wherever you see self it usually implies the properties type of the calling object. For this reason, we tend to define these methods as generic. See for the example how we defined the Go.animate() https://github.com/hxdefold/hxdefold/blob/master/src/defold/Go.hx#L40 method.
- In your haxelib.json, it might be a good idea to add hxdefold as a dependency. (see here https://lib.haxe.org/documentation/creating-a-haxelib-package/)
Despite that, I resumed work on a tool https://github.com/hxdefold/hxdefold-extern-gen which will automatically parse the Defold documentation and generate Haxe externs. When that's done, I will prepare a new haxelib which will be a collection of Defold library externs. When that's done you can contribute to it as you want :)
— Reply to this email directly, view it on GitHub https://github.com/hxdefold/hxdefold/issues/34#issuecomment-1280437164, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKIDEAOHCFNO2TEOSXYUJTWDUAVVANCNFSM6AAAAAARBCIELA . You are receiving this because you authored the thread.Message ID: @.***>
The package is in work here: hxdefold-extensions
Currently a work-in-progress with automatically generated files. It will go on haxelib when all the errors are fixed.
So feel free to contribute there.