22 #ifndef CHIPMUNK_HEADER
23 #define CHIPMUNK_HEADER
26 #define _USE_MATH_DEFINES
36 #ifndef CP_ALLOW_PRIVATE_ACCESS
37 #define CP_ALLOW_PRIVATE_ACCESS 0
40 #if CP_ALLOW_PRIVATE_ACCESS == 1
41 #define CP_PRIVATE(__symbol__) __symbol__
43 #define CP_PRIVATE(__symbol__) __symbol__##_private
46 void cpMessage(
const char *condition,
const char *file,
int line,
int isError,
int isHardError,
const char *message, ...);
48 #define cpAssertWarn(__condition__, ...)
50 #define cpAssertWarn(__condition__, ...) if(!(__condition__)) cpMessage(#__condition__, __FILE__, __LINE__, 0, 0, __VA_ARGS__)
54 #define cpAssertSoft(__condition__, ...)
56 #define cpAssertSoft(__condition__, ...) if(!(__condition__)) cpMessage(#__condition__, __FILE__, __LINE__, 1, 0, __VA_ARGS__)
60 #define cpAssertHard(__condition__, ...) if(!(__condition__)) cpMessage(#__condition__, __FILE__, __LINE__, 1, 1, __VA_ARGS__)
63 #include "chipmunk_types.h"
69 #ifndef CP_BUFFER_BYTES
70 #define CP_BUFFER_BYTES (32*1024)
75 #define cpcalloc calloc
80 #define cprealloc realloc
88 typedef struct cpArray cpArray;
89 typedef struct cpHashSet cpHashSet;
95 typedef struct cpCollisionHandler cpCollisionHandler;
102 #include "cpSpatialIndex.h"
106 #include "cpPolyShape.h"
108 #include "cpArbiter.h"
109 #include "constraints/cpConstraint.h"
114 #define CP_VERSION_MAJOR 6
115 #define CP_VERSION_MINOR 2
116 #define CP_VERSION_RELEASE 1
176 #define CP_CONVEX_HULL(__count__, __verts__, __count_var__, __verts_var__) \
177 cpVect *__verts_var__ = (cpVect *)alloca(__count__*sizeof(cpVect)); \
178 int __count_var__ = cpConvexHull(__count__, __verts__, __verts_var__, NULL, 0.0); \
180 #if defined(__has_extension)
181 #if __has_extension(blocks)
186 void cpSpaceEachBody_b(
cpSpace *space,
void (^block)(
cpBody *body));
187 void cpSpaceEachShape_b(
cpSpace *space,
void (^block)(
cpShape *shape));
190 void cpBodyEachShape_b(
cpBody *body,
void (^block)(
cpShape *shape));
192 void cpBodyEachArbiter_b(
cpBody *body,
void (^block)(
cpArbiter *arbiter));
200 typedef void (^cpSpaceBBQueryBlock)(
cpShape *shape);