kivy / cymunk

Cython port of Pymunk
http://readthedocs.org/docs/cymunk/en/latest/
MIT License
45 stars 29 forks source link

Fixed datatype size + Bake defines #50

Open SleepProgger opened 6 years ago

SleepProgger commented 6 years ago

This PR adds changes to the setup.py script to "bake" the defines used at compile time by generating a config.h file which is included in chipmunk.h. This allows to change the types used for cpFloat (except for apple devices) plus the sizes of cpGroup, cpLayer and so on.

Additionally it exposes these types as the biggest possible types (uint64_t / double) on the cython side. Currently cymunk.pxd exposes cpFloat as float while chipmunk uses by default doubles. While cython will internally use the type defined in the .h file (double), the type defined in cython will be used to convert to/from python. Thus a number too big for a float will be returned to the python side as INFINITE. Too large integers will raise an OverflowError.

I also removed the duplicate include folder.

Berserker66 commented 6 years ago

Doesn't work on Python 3, due to line 52 in setup.py - you use dict.iter_items, which in python 3 is dict.items