Mercurial > projects > chipmunkd
diff trunk/chipmunkd/cpSpaceQuery.d @ 29:80058cee1a77
updated to chipmunk 5.3.4
author | Extrawurst |
---|---|
date | Thu, 16 Dec 2010 00:33:06 +0100 |
parents | 4ceef5833c8c |
children |
line wrap: on
line diff
--- a/trunk/chipmunkd/cpSpaceQuery.d Mon Dec 13 21:40:56 2010 +0100 +++ b/trunk/chipmunkd/cpSpaceQuery.d Thu Dec 16 00:33:06 2010 +0100 @@ -29,10 +29,10 @@ { pointQueryContext context = {layers, group, func, data}; - cpBool locked = space.locked; space.locked = cpTrue; { + cpSpaceLock(space);{ cpSpaceHashPointQuery(space.activeShapes, point, cast(cpSpaceHashQueryFunc)&pointQueryHelper, &context); cpSpaceHashPointQuery(space.staticShapes, point, cast(cpSpaceHashQueryFunc)&pointQueryHelper, &context); - } space.locked = locked; + } cpSpaceUnlock(space); } static void @@ -50,15 +50,6 @@ return shape; } -void -cpSpaceEachBody(cpSpace *space, cpSpaceBodyIterator func, void *data) -{ - cpArray *bodies = space.bodies; - - for(int i=0; i<bodies.num; i++) - func(cast(cpBody *)bodies.arr[i], data); -} - //#pragma mark Segment Query Functions struct segQueryContext { @@ -92,10 +83,10 @@ func, }; - cpBool locked = space.locked; space.locked = cpTrue; { + cpSpaceLock(space);{ cpSpaceHashSegmentQuery(space.staticShapes, &context, start, end, 1.0f, cast(cpSpaceHashSegmentQueryFunc)&segQueryFunc, data); cpSpaceHashSegmentQuery(space.activeShapes, &context, start, end, 1.0f, cast(cpSpaceHashSegmentQueryFunc)&segQueryFunc, data); - } space.locked = locked; + } cpSpaceUnlock(space); } struct segQueryFirstContext { @@ -168,10 +159,10 @@ { bbQueryContext context = {layers, group, func, data}; - cpBool locked = space.locked; space.locked = cpTrue; { + cpSpaceLock(space);{ cpSpaceHashQuery(space.activeShapes, &bb, bb, cast(cpSpaceHashQueryFunc)&bbQueryHelper, &context); cpSpaceHashQuery(space.staticShapes, &bb, bb, cast(cpSpaceHashQueryFunc)&bbQueryHelper, &context); - } space.locked = locked; + } cpSpaceUnlock(space); } //#pragma mark Shape Query Functions @@ -226,10 +217,10 @@ cpBB bb = cpShapeCacheBB(shape); shapeQueryContext context = {func, data, cpFalse}; - cpBool locked = space.locked; space.locked = cpTrue; { + cpSpaceLock(space);{ cpSpaceHashQuery(space.activeShapes, shape, bb, cast(cpSpaceHashQueryFunc)&shapeQueryHelper, &context); cpSpaceHashQuery(space.staticShapes, shape, bb, cast(cpSpaceHashQueryFunc)&shapeQueryHelper, &context); - } space.locked = locked; + } cpSpaceUnlock(space); return context.anyCollision; }