(c) S. Delcroix 2013 |
At this point in time, the ~2000 lines of manually crafted lines of code can be found
What's missing ?
Mainly queries, plus a few function calls here and there.Integrate with cocos2d
If you build the Chipmunk bindings from within the mono touch-bindings/cocos2d folder, with ENABLE_CHIPMUNK_INTEGRATION=1, Chipmunk will be build inside of the Cocos2d.dll, and you'll also get the CCPhysicsSprite class acting as integration layer between a Cocos2d sprite and a Chipmunk body.
Memory management
tl;dr Always keep a reference to your Space object and you'll be fine.
Multiple Chipmunk managed objects can hold a reference to the same native struct (for example, you could have the object you added to the space, and then another one pointing to the same native ref returned from a callback). As such, we can't free the native memory when a managed object is GC'd. To workaround this, we keep a table of all the managed objects (except for Arbiters) pointing to a native one, and only free the native pointer when the last managed instance is disposed.
In addition, the Space keep a managed reference to all the Bodies, Shapes and Constraint added, so the native memory isn't freed even if your code doesn't keep a ref to the body/shape/constraint. So, keep a ref to the Space and everything we'll be fine, provided that you create all the Chipmunk objects from the managed side.
For more on this, or something totally different, contact me, I'm open for contracting.
For more on this, or something totally different, contact me, I'm open for contracting.
No comments:
Post a Comment