Page 1 of 1

Chipmunk C++ Wrapper

Posted: Wed Mar 07, 2012 10:04 am
by jhasse
Hi!

I've created a new C++ wrapper for Chipmunk 6. The old one wasn't using a namespace, depended on boost::shared_ptr and was tested only with Chipmunk 4.

http://github.com/jhasse/chipmunkpp/

It's not finished yet, but I will improve it in the next weeks. Please tell me what you think of it and if you have any suggestion for the design, code style, etc. ;)

Re: Chipmunk C++ Wrapper

Posted: Fri Jun 15, 2012 6:00 am
by jhasse
I've created a small homepage using github: http://jhasse.github.com/chipmunkpp/

@slembcke
Could you add my wrapper to http://chipmunk-physics.net/bindingsAndPorts.php ? :)

Btw: The bindings and ports link at http://chipmunk-physics.net/release/Chi ... test-Docs/ is broken ;)

Re: Chipmunk C++ Wrapper

Posted: Fri Jun 15, 2012 6:58 am
by aisman
Hello jhase,

Can you tell us which Chipmunk version and the completenes of the wrapper?

Re: Chipmunk C++ Wrapper

Posted: Fri Jun 15, 2012 8:00 am
by jhasse
aisman wrote:Hello jhase,

Can you tell us which Chipmunk version and the completenes of the wrapper?
Hi,

It's using the latest version (6.1.1) and it isn't complete yet (maybe 20%?). I'm already using it in my project, but I only use a small amount of Chipmunk atm (e.g. no joints, etc.). Sorry :(

Re: Chipmunk C++ Wrapper

Posted: Fri Jun 15, 2012 12:34 pm
by slembcke
Updated!

I've been pondering about making an official Chipmunk C++ wrapper for a while now. (I just rarely program in C++) I have a ruby script in Git called "extract_protos.rb" that I use for pulling all the function data for working on the docs sometimes. It should make it pretty easy to generate a set of C++ bindings from a script. The C/C++ API would be almost entirely a 1:1 correspondence anyway. I'm not quite sure exactly how long that would take though.

Anyway. It's much appreciated that you are filling this need until/if I have time to make a more complete solution. :) Thanks!

Re: Chipmunk C++ Wrapper

Posted: Mon Jun 18, 2012 7:59 am
by jhasse
slembcke wrote:Updated!
Thanks!
I've been pondering about making an official Chipmunk C++ wrapper for a while now. (I just rarely program in C++) I have a ruby script in Git called "extract_protos.rb" that I use for pulling all the function data for working on the docs sometimes. It should make it pretty easy to generate a set of C++ bindings from a script. The C/C++ API would be almost entirely a 1:1 correspondence anyway. I'm not quite sure exactly how long that would take though.
Unfortunately it isn't that easy, especially if you're trying to make a modern and nice wrapper. For example the cpSpaceSegmentQuery function I've implemented today in Chipmunk++ is quite different than a simple wrapper in order to allow passing lambdas:

Code: Select all

space.segmentQuery(a, b, ALL_LAYERS, NO_GROUP, [&](std::shared_ptr<Shape> shape, Float, Vect) {
	// do something with shape
});