google / liquidfun

2D physics engine for games
http://google.github.io/liquidfun
4.71k stars 643 forks source link

Bind functions into b2Joint, and make Joints inherited from b2Joint #91

Open haskasu opened 6 years ago

haskasu commented 6 years ago

in order to debugDraw joints in lfjs, we need to add GetAnchorA() and GetAnchorB() functions in all b2Joints So what this pr does are:

  1. make all Joint classes (b2DistanceJoint for instance) extends from b2Joint
  2. reorder the classes in uglify.sh, to make sure all joint class load after b2Joint
  3. bind methords of all Joints classes
  4. add js variables to quick access b2Joint properties
alexames commented 6 years ago

Can you squash this down to a single commit?

Generally looks good, but I want to get at least one more pair of eyes on it before I approve it. One thing I did notice is that in some files the indentation is inconsistent. Some places use two spaces for indentation, some use 4. Can you fix these? I marked some of them, but check other files for inconsistencies too.

haskasu commented 6 years ago

I think i successfully squashed to one commit ( i am a git newbie) And I've make indents to 2 spaces, so it should look better.

danbri commented 3 years ago

Hi @alexames @haskasu

I have been trying to build the latest codebase using current emscripten toolchain (on Chromebook, via emsdk, including "emsdk install fastcomp-clang-e1.38.31-64bit" since liquidfun docs ask for fastcomp). I was hoping for wasm rather than js, eventually, but initial challenge is to get anything built:

A naive attempt fails with

emcc: error: undefined exported symbol: "_b2GearJointDef_InitializeAndCreate" [-Wundefined] [-Werror]

Since googling for "_b2GearJointDef_InitializeAndCreate" finds exactly one hit - this PR - it seemed worth mentioning here.

danbri commented 3 years ago

I should add that https://github.com/haskasu/liquidfun gives me the same emcc build error; as does liquidfun-1.1.0.zip. Despite the error, an "lf_core.wasm" (size 234940) does get produced.