Skip to content

Commit

Permalink
Merge pull request slembcke#236 from brianwatling/fixes
Browse files Browse the repository at this point in the history
Compile fixes for C on MSVC
  • Loading branch information
slembcke authored Sep 1, 2023
2 parents 79d9eca + b1ae4c4 commit d0239ef
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 8 additions & 0 deletions include/chipmunk/cpMarch.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2013 Howling Moon Software. All rights reserved.
// See http://chipmunk2d.net/legal.php for more information.

#ifdef __cplusplus
extern "C" {
#endif

/// Function type used as a callback from the marching squares algorithm to sample an image function.
/// It passes you the point to sample and your context pointer, and you return the density.
typedef cpFloat (*cpMarchSampleFunc)(cpVect point, void *data);
Expand All @@ -26,3 +30,7 @@ CP_EXPORT void cpMarchHard(
cpMarchSegmentFunc segment, void *segment_data,
cpMarchSampleFunc sample, void *sample_data
);

#ifdef __cplusplus
}
#endif
8 changes: 8 additions & 0 deletions include/chipmunk/cpPolyline.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2013 Howling Moon Software. All rights reserved.
// See http://chipmunk2d.net/legal.php for more information.

#ifdef __cplusplus
extern "C" {
#endif

// Polylines are just arrays of vertexes.
// They are looped if the first vertex is equal to the last.
// cpPolyline structs are intended to be passed by value and destroyed when you are done with them.
Expand Down Expand Up @@ -68,3 +72,7 @@ CP_EXPORT void cpPolylineSetCollectSegment(cpVect v0, cpVect v1, cpPolylineSet *
CP_EXPORT cpPolylineSet *cpPolylineConvexDecomposition(cpPolyline *line, cpFloat tol);

#define cpPolylineConvexDecomposition_BETA cpPolylineConvexDecomposition

#ifdef __cplusplus
}
#endif
6 changes: 3 additions & 3 deletions src/cpBody.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ cpBodyFree(cpBody *body)
#ifdef NDEBUG
#define cpAssertSaneBody(body)
#else
static void cpv_assert_nan(cpVect v, char *message){cpAssertHard(v.x == v.x && v.y == v.y, message);}
static void cpv_assert_infinite(cpVect v, char *message){cpAssertHard(cpfabs(v.x) != INFINITY && cpfabs(v.y) != INFINITY, message);}
static void cpv_assert_sane(cpVect v, char *message){cpv_assert_nan(v, message); cpv_assert_infinite(v, message);}
static void cpv_assert_nan(cpVect v, const char *message){cpAssertHard(v.x == v.x && v.y == v.y, message);}
static void cpv_assert_infinite(cpVect v, const char *message){cpAssertHard(cpfabs(v.x) != INFINITY && cpfabs(v.y) != INFINITY, message);}
static void cpv_assert_sane(cpVect v, const char *message){cpv_assert_nan(v, message); cpv_assert_infinite(v, message);}

static void
cpBodySanityCheck(const cpBody *body)
Expand Down

0 comments on commit d0239ef

Please sign in to comment.