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

Haxe externs #19

Closed
NicolasVereenoghe opened this issue Apr 18, 2017 · 8 comments
Closed

Haxe externs #19

NicolasVereenoghe opened this issue Apr 18, 2017 · 8 comments

Comments

@NicolasVereenoghe
Copy link

Not an issue, but just to let you know that I am working on externs for Haxe (not shure of the best practice to post this) :

https://github.com/NicolasVereenoghe/git.vega.pixi4/tree/master/haxe/lib/planck%2Cjs

It's a first try, and for now the externs are hosted into my framework repository.

I'm going to deal with serious testing the coming days. I hope it will make the job ^^

If you're interested, try it or tell ... I may create another repository for the Haxe externs, for now I'm not sure :)

@shakiba
Copy link
Collaborator

shakiba commented Apr 18, 2017

Cool! Does it require specifying static types for methods' arguments and return?

@NicolasVereenoghe
Copy link
Author

They are already defined into the externs :
sometimes I had to create some new "typedef" that conform to yours :
https://github.com/NicolasVereenoghe/git.vega.pixi4/blob/master/haxe/lib/planck%2Cjs/0%2C1%2C34/src/planck/World.hx#L10-L29

... or sometimes they are just externs of yours :
https://github.com/NicolasVereenoghe/git.vega.pixi4/blob/master/haxe/lib/planck%2Cjs/0%2C1%2C34/src/planck/collision/Distance.hx#L14-L43

For now I've just checked the instances are created (World, Body .... Transform ...) and filled correctly. I followed the provided index.js file and tryed to deal with code that is exposed (not all protected members, not the Solver class, I believe the latter can remain hidden for now)

More testing is needed, I work for a client and I will test it this week ....

@shakiba
Copy link
Collaborator

shakiba commented Apr 18, 2017

That's interesting and very helpful! Do you know how does it compare to TypeScript types? Because someone asked me about it before.

@NicolasVereenoghe
Copy link
Author

Sorry, I dont have expertise with TypeScript

@shakiba
Copy link
Collaborator

shakiba commented Apr 18, 2017

Ah, ok. Please keep me updated about your work, I'm interested to see how it works.

@NicolasVereenoghe
Copy link
Author

NicolasVereenoghe commented Apr 24, 2017

Hello,

My work is still in progress, and for now the planckjs seems to run properly with the Haxe externs.
I cannot show a demo because it's for a client. It's a mini game where you need to complete a level by adding blocks, so that a ball can travel to a goal.

From my first post, I had to adjust the externs to be compliant with your code, I updated them into my framework repository (see previous links). I copy my "commit comments" here :
. optional Body::createFixture parameters
. optional parameters for Fixture constructor
. added FixtureDef::shape field
. adjusted signature for World::on and World::off events registration functions
. added constants for world events labels (WORLD_REMOVE_BODY,WORLD_REMOVE_JOINT,WORLD_REMOVE_FIXTURE,WORLD_CONTACT_BEGIN,WORLD_CONTACT_END,WORLD_CONTACT_PRE,WORLD_CONTACT_POST)
. warning : you have to explicitly set a body as dynamic, even if its fixtures have a non 0 density

I continue the testings :)

@NicolasVereenoghe
Copy link
Author

Hello, here a game demo extracted from my work for my client. I think I can share this :
https://github.com/NicolasVereenoghe/vega.labo.pampamplanck

The game is redeveloped from former Flash Box2D sources. Mechanics are very simple. It conforms to the original game. No issues for now, just some adjustments to adapt to the last Box2D API.

@shakiba
Copy link
Collaborator

shakiba commented May 14, 2017

Awesome! :) I'm glad it worked for you. I will add it to a new demo list in near future.

@shakiba shakiba closed this as completed Aug 23, 2023
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

No branches or pull requests

2 participants