Yes, that would probably make life much easier.
The other problems were functions that return a
struct, being initialized on
return, like:
Code: Select all
static inline cpVect
cpv(const cpFloat x, const cpFloat y)
{
return (cpVect){x, y};
}
I mean it looks nice and is totally readable, but c99-only. The following example shows a little more ugly, but MSVC friendlier Version. For my part, I just defined a constructor for those structs, but that won't probably work for the c99 standard.
Code: Select all
static inline cpVect
cpv(const cpFloat x, const cpFloat y)
{
cpVect v={x,y};
return v;
}
Ah, and i just remembered, that the math headers of MSVC don't define INFINITY, but i found this hack somewhere on the internet, that I placed on top of the chipmunk.h header :
Code: Select all
#ifndef INFINITY
//#define INFINITY (1.0f/0.0f)
union MSVC_EVIL_FLOAT_HACK
{
unsigned __int8 Bytes[4];
float Value;
};
static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}};
#define INFINITY (INFINITY_HACK.Value)
#endif
You also need to define _USE_MATH_DEFINES before including math.h, or else M_PI won't be defined. I think this should sum up most of the problems. Anyway, the engine is just awesome.