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

Do you have a plane to Change the name of API ? #7

Open
finscn opened this issue Apr 28, 2018 · 4 comments
Open

Do you have a plane to Change the name of API ? #7

finscn opened this issue Apr 28, 2018 · 4 comments

Comments

@finscn
Copy link
Contributor

finscn commented Apr 28, 2018

@flyover , Hi ,
Do you have a plane to Change the name of API , then provide a JavaScript-friendly API ?

example:
box2d.b2BodyDef --> Box2d.bodyDef
world.CreateBody --> world.createBody
b2BodyType.b2_dynamicBody --> bodyType.dynamicBody
...

the things https://github.com/shakiba/planck.js do :

  • b2 prefix is dropped from class names, for example b2World is now available as planck.World.
  • Method names are converted from UpperCamelCase to lowerCamelCase.
  • Definition classes/objects (BodyDef, FixtureDef, etc.) are replaced by inline JavaScript objects ({}).
  • Shapes are made immutable and are not cloned when used to create fixtures.
  • World#on(eventName, listenerFn) and World#off(eventName, listenerFn) are added to add and remove event listeners. Currently supported events are:
    • 'begin-contact'
    • 'end-contact'
    • 'pre-solve'
    • 'post-solve'
    • 'joint-removed'
    • 'fixture-removed'
    • `'body-removed'
@Nick-Riggs
Copy link

This lib is looking awesome and it's performance is very good.

👍 I would also like to see the naming conventions more along the lines of ECMAScript standards.

@Nek-
Copy link
Contributor

Nek- commented May 21, 2018

Why?

On my side, I'm in favor of using Box2D standards. To improve code portability.

@alpertuna
Copy link

alpertuna commented Jul 4, 2018

I also don't like the Box2D API naming BUT to benefit Box2D manual and tuts on internet, changing API may not be a good idea. Instead I have some wrapper classes on my project to use Box2D easily.
Btw thanks @flyover ! for preparing this ts version, so that I can find my way using autocompletions.

@flyover
Copy link
Owner

flyover commented Nov 25, 2019

Yeah, I think I'm going to leave it as close to the original API as possible. Perhaps a wrapper that added some of these JS features would be nice, especially if the underlying physics engine could be swapped out.

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

5 participants