Redefineable cpFloat
Posted: Wed Oct 08, 2008 3:22 pm
Chipmunk currently uses doubles as its default type for cpFloat, which I think is great, but those developing for the iPhone would probably prefer to use floats since the iPhone handles those much faster. The old documentation, from back when cpFloat was float, states that it should be safe to redefine cpFloat. is this still true?
If so, I believe that it would make things easier for developers working on projects that target both desktop and iPhone platforms to have cpFloat's typedef defined using a macro. Right now, for the experimental iPhone port that I have, we're keeping two copies of chipmunk.h. One with double and one with float. I have attached a diff to the current trunk (revision 72) which demonstrates how chipmunk.h could be modified to allow developers to change the type of cpFloat using a -D flag. This would allow us to keep one copy of the code for all platforms.
If so, I believe that it would make things easier for developers working on projects that target both desktop and iPhone platforms to have cpFloat's typedef defined using a macro. Right now, for the experimental iPhone port that I have, we're keeping two copies of chipmunk.h. One with double and one with float. I have attached a diff to the current trunk (revision 72) which demonstrates how chipmunk.h could be modified to allow developers to change the type of cpFloat using a -D flag. This would allow us to keep one copy of the code for all platforms.