This project aims to provide a full FFI wrapper around Chipmunk 2D physics engine for PHP. What a time to be alive!
Via Composer
$ composer require devnix/chipmunkphp
You will need to compile and install Chipmunk 7
cd /tmp
git clone [email protected]:slembcke/Chipmunk2D.git
cd Chipmunk2D
Find the latest 7.x tag and checkout it
git tag
Chipmunk-6.0.0
Chipmunk-6.0.1
Chipmunk-6.0.2
Chipmunk-6.0.3
Chipmunk-6.1
Chipmunk-6.1.1
Chipmunk-6.1.2
Chipmunk-6.1.3
Chipmunk-6.1.4
Chipmunk-6.1.5
Chipmunk-6.2.0
Chipmunk-6.2.1
Chipmunk-6.2.2
Chipmunk-7.0.0
Chipmunk-7.0.1
Chipmunk-7.0.2
Chipmunk-7.0.3
Cocos2D-3.0
git checkout Chipmunk-7.0.3
Then compile, install and clear shared libraries cache.
cmake .
make
sudo make install
sudo ldconfig
And should be done. Please, give us feedback if you have problems opening an issue.
Please see CHANGELOG for more information on what has changed recently.
The header file for the FFI API must be already processed. You can do it with GCC (I'm just messing with the parameters...):
cpp -P -E -D "__attribute__(ARGS)=" ~/tmp/Chipmunk2D/include/chipmunk/chipmunk.h -o include/chipmunk.h -save-temps
Don't forget to hange the /tmp/Chipmunk2D
path to your needs.
After that, manually remove code of inline functions and let there only the signature. You will also have to manually delete the stdio.h and math.h (I guess) signatures.
I've been messing with ircmaxell/FFIMe but it seems like there is some kind of problem when parsing with ircmaxell/php-c-parser. I would love to find a way to automatically get the working header file automatically to ease the work.
$ composer test
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
- Pablo Largo Mohedano, author of this package.
- Victor Blomqvist, I have stolen documentation and ideas from Pymunk.
- Scott Lembcke and Howling Moon Software, makers of Chipmnunk, parts of C header files are in this project.
- All Contributors
The MIT License (MIT). Please see License File for more information.