hxdefold icon indicating copy to clipboard operation
hxdefold copied to clipboard

Import Dependencies specified in game.project file using Haxe

Open ABDERRAHMANE-OUALI opened this issue 3 years ago • 7 comments

I'm using Rive dependency inside my Defold project but I don't know how to import these dependencies inside my Haxe file

ABDERRAHMANE-OUALI avatar Oct 10 '22 07:10 ABDERRAHMANE-OUALI

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 😄

haath avatar Oct 10 '22 09:10 haath

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

ABDERRAHMANE-OUALI avatar Oct 10 '22 15:10 ABDERRAHMANE-OUALI

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.

haath avatar Oct 11 '22 13:10 haath

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) ?

ABDERRAHMANE-OUALI avatar Oct 11 '22 20:10 ABDERRAHMANE-OUALI

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

ABDERRAHMANE-OUALI avatar Oct 15 '22 11:10 ABDERRAHMANE-OUALI

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() method.
  • In your haxelib.json, it might be a good idea to add hxdefold as 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 :)

haath avatar Oct 17 '22 07:10 haath

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:

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: @.***>

ABDERRAHMANE-OUALI avatar Oct 17 '22 10:10 ABDERRAHMANE-OUALI

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.

haath avatar Oct 21 '22 11:10 haath