Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cpShapeIsPoly, cpShapeIsSegment, cpShapeIsCircle functions #223

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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