Created
March 14, 2014 18:46
-
-
Save fowlmouth/9554171 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type | |
| parbiter = object | |
| swappedcoll: bool | |
| a,b: pshape | |
| pshape = ptr object | |
| #/ Return the colliding shapes involved for this arbiter. | |
| #/ The order of their cpSpace.collision_type values will match | |
| #/ the order set when the collision handler was registered. | |
| proc getShapes*(arb: PArbiter, a, b: var PShape) {.inline.} = | |
| if arb.swappedColl.bool: | |
| a = arb.b | |
| b = arb.a | |
| else: | |
| a = arb.a | |
| b = arb.b | |
| #/ A macro shortcut for defining and retrieving the shapes from an arbiter. | |
| #define CP_ARBITER_GET_SHAPES(arb, a, b) cpShape *a, *b; cpArbiterGetShapes(arb, &a, &b); | |
| template getShapes*(arb: PArbiter, name1, name2: expr): stmt {.immediate.} = | |
| var name1, name2: PShape | |
| getShapes(arb, name1, name2) | |
| var | |
| arb: PArbiter | |
| a,b: PShape | |
| getshapes(arb,a,b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment