You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cpShapes may be of several underlying types (cpPolyShape, cpCircleShape, etc). There are methods that only work with the appropriate type and, per the documentation, throw an assert if called on an inappropriate shape. But there is no way to determine whether a cpShape is a poly shape, circle shape, or something else. In old Chipmunk you could get a cpShapeType out of the cpShape structure, but now structures are opaque.
This could create a problem if, for example, you were writing a generic debugDraw() callback for use with cpShapeEach that draws a polygon for polygon shapes, a circle for circle shapes etc. Unless you layered on application-level metadata about what kind of shape each object is, such a generic callback would not be possible.
Expected behavior: There should be either a cpShapeGetType() returning an enum, or a set of cpShapeIsPoly()/cpShapeIsCircle() functions that identify when a shape is safe to promote. I am considering patching in the cpShapeIsPoly() solution myself and could submit a PR.
The text was updated successfully, but these errors were encountered:
cpShapes may be of several underlying types (cpPolyShape, cpCircleShape, etc). There are methods that only work with the appropriate type and, per the documentation, throw an assert if called on an inappropriate shape. But there is no way to determine whether a cpShape is a poly shape, circle shape, or something else. In old Chipmunk you could get a cpShapeType out of the cpShape structure, but now structures are opaque.
This could create a problem if, for example, you were writing a generic debugDraw() callback for use with cpShapeEach that draws a polygon for polygon shapes, a circle for circle shapes etc. Unless you layered on application-level metadata about what kind of shape each object is, such a generic callback would not be possible.
Expected behavior: There should be either a
cpShapeGetType()
returning an enum, or a set ofcpShapeIsPoly()
/cpShapeIsCircle()
functions that identify when a shape is safe to promote. I am considering patching in the cpShapeIsPoly() solution myself and could submit a PR.The text was updated successfully, but these errors were encountered: