Penpo / box2dweb

Automatically exported from code.google.com/p/box2dweb
0 stars 0 forks source link

Feature request - node.js/commonJS support #22

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The feature request is a node.js (and incidentally a commonJS compatible) 
version of the library.

Following the node.js and CommonJS specification http://www.commonjs.org/specs/ 
I added a lot of 'exports'-assignments at the end of the library like so:

exports.Box2D = {} ;
exports.Box2D.Collision = {};
exports.Box2D.Collision.b2AABB = Box2D.Collision.b2AABB;
exports.Box2D.Collision.b2Bound = Box2D.Collision.b2Bound;
...

and so on for all public API functions. 

I have only done minimal testing but so far it works as expected with setting 
up the world and simulating some simple things. 

Even cooler would be if the library was available through the node package 
manager (http://npmjs.org/).

Original issue reported on code.google.com by jo...@zoom.nu on 15 Aug 2011 at 4:53

GoogleCodeExporter commented 9 years ago
I've build a patch against r29, that adds exports and fixes a bug in 
Object.defineProperty() fallback (Object.prototype.defineProperty is undefined 
in Node.js, thus Object.defineProperty gets overwritten, which occasionaly 
corrupts this...).

Original comment by schulz...@gmail.com on 23 Nov 2012 at 5:11

Attachments: