Skip to content

Latest commit

 

History

History
133 lines (97 loc) · 3.91 KB

README.md

File metadata and controls

133 lines (97 loc) · 3.91 KB

devnix/chipmunkphp

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

This project aims to provide a full FFI wrapper around Chipmunk 2D physics engine for PHP. What a time to be alive!

Install

Via Composer

$ composer require devnix/chipmunkphp

Dependencies

Linux

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.

Change log

Please see CHANGELOG for more information on what has changed recently.

Hacking

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.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.