Skip to content

Conversation

@mcclure
Copy link

@mcclure mcclure commented Mar 14, 2022

Addresses #219.

Imagine you are writing a cpShapeEach callback to draw a scene which contains both circle and poly shapes. At the moment, there is no way to determine whether any one shape addressed by the callback is a circle, a poly, or something else. However telling circles and polys apart is necessary because functions like cpPolyShapeGetCount() assert-crash when called on the wrong kind of shape.

This patch adds three new functions cpShapeIsPoly, cpShapeIsSegment, cpShapeIsCircle that do the expected thing. I am indifferent to whether this is the best naming for these functions.

I tested this by doing a successful build and calling cpShapeIsPoly in live code (although my tests were in a feature branch based on older Chipmunk.) I did not attempt to modify any documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant