mvasilkov / box2d-html5

A 2D Physics Engine for HTML5 Games
22 stars 1 forks source link

possibly missing b2DebugDraw and can you maintain the namespace structure? #1

Open headwinds opened 10 years ago

headwinds commented 10 years ago

I've downloaded the latest release and tried to load.html file in the test folder.

I can see the box2d success message and see that box2d is available to use.

I tried some sample code against it.

http://blog.sethladd.com/2011/09/box2d-javascript-example-walkthrough.html

I found that b2DebugDraw is missing and your version of box2d seems to flatten the file structure.

In Seth's version, there is:

var b2Vec2 = Box2D.Common.Math.b2Vec2

but in your version, it's flat

var b2Vec2 = Box2D.b2Vec2;

Just curious, if you can maintain that structure when you build your sweet single versoin? And do you where I can find the b2DebugDraw on your version?

mvasilkov commented 10 years ago

Hi,

On package structure: I try to stay close to the original C++ version of the code. http://code.google.com/p/box2d/source/browse/trunk/Box2D/Box2D/Common/b2Math.h

And DebugDraw is here. Using it may be not very obvious, please tell me if I should provide a “hello, world” style demo code.

(Side note: what do you think, should I just port some of the more popular tutorials?)

headwinds commented 10 years ago

Ahh ok it's probably box2dweb that deviated from the original - in that case, it's better to stay closer to the original I guess and provide a bit more documentation about the difference.

Yes, I definitely think this project needs a "tutorial" or "game" folder to appeal html5 game developers - I simply took your load.html and created a game.html with an external game.js containing Seth's example.

https://gist.github.com/headwinds/96d27083d4ca5c0f2ab1

Then, in your readme file, I would add a simple Getting Started headline and direct developers to that folder. The first thing I wanted to do was open the file in my browser and see some physics. Using an example with debug draw on is the fastest way to achieve this because it doesn't rely on any other assets.