本文整理汇总了C++中cpAssertSpaceUnlocked函数的典型用法代码示例。如果您正苦于以下问题:C++ cpAssertSpaceUnlocked函数的具体用法?C++ cpAssertSpaceUnlocked怎么用?C++ cpAssertSpaceUnlocked使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cpAssertSpaceUnlocked函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cpSpaceAddCollisionHandler
void
cpSpaceAddCollisionHandler(
cpSpace *space,
cpCollisionType a, cpCollisionType b,
cpCollisionBeginFunc begin,
cpCollisionPreSolveFunc preSolve,
cpCollisionPostSolveFunc postSolve,
cpCollisionSeparateFunc separate,
void *data
){
cpAssertSpaceUnlocked(space);
// Remove any old function so the new one will get added.
cpSpaceRemoveCollisionHandler(space, a, b);
cpCollisionHandler handler = {
a, b,
begin ? begin : alwaysCollide,
preSolve ? preSolve : alwaysCollide,
postSolve ? postSolve : nothing,
separate ? separate : nothing,
data
};
cpHashSetInsert(space->collFuncSet, CP_HASH_PAIR(a, b), &handler, NULL);
}
开发者ID:jelowang,项目名称:i51,代码行数:26,代码来源:cpSpace.cpp
示例2: cpSpaceRemoveBody
void
cpSpaceRemoveBody(cpSpace *space, cpBody *body)
{
cpAssert(cpArrayContains(space->bodies, body), "Cannot remove a body that was never added to the space.");
cpAssertSpaceUnlocked(space);
cpArrayDeleteObj(space->bodies, body);
}
开发者ID:Avizzv92,项目名称:WreckingBall,代码行数:8,代码来源:cpSpace.c
示例3: cpSpaceRemoveCollisionHandler
void
cpSpaceRemoveCollisionHandler(cpSpace *space, cpCollisionType a, cpCollisionType b)
{
cpAssertSpaceUnlocked(space);
struct{cpCollisionType a, b;} ids = {a, b};
cpCollisionHandler *old_handler = (cpCollisionHandler *) cpHashSetRemove(space->collFuncSet, CP_HASH_PAIR(a, b), &ids);
cpfree(old_handler);
}
开发者ID:jelowang,项目名称:i51,代码行数:9,代码来源:cpSpace.cpp
示例4: cpSpaceAddShape
cpShape *
cpSpaceAddShape(cpSpace *space, cpShape *shape)
{
cpAssert(shape->body, "Cannot add a shape with a NULL body.");
cpAssert(!cpHashSetFind(space->activeShapes->handleSet, shape->hashid, shape), "Cannot add the same shape more than once.");
cpAssertSpaceUnlocked(space);
cpSpaceHashInsert(space->activeShapes, shape, shape->hashid, shape->bb);
return shape;
}
开发者ID:Avizzv92,项目名称:WreckingBall,代码行数:10,代码来源:cpSpace.c
示例5: cpSpaceRemoveStaticShape
void
cpSpaceRemoveStaticShape(cpSpace *space, cpShape *shape)
{
cpAssert(cpHashSetFind(space->staticShapes->handleSet, shape->hashid, shape), "Cannot remove a static shape that was never added to the space.");
cpAssertSpaceUnlocked(space);
removalContext context = {space, shape};
cpHashSetFilter(space->contactSet, (cpHashSetFilterFunc)contactSetFilterRemovedShape, &context);
cpSpaceHashRemove(space->staticShapes, shape, shape->hashid);
}
开发者ID:Avizzv92,项目名称:WreckingBall,代码行数:10,代码来源:cpSpace.c
示例6: cpSpaceRemoveBody
void
cpSpaceRemoveBody(cpSpace *space, cpBody *body)
{
cpAssertHard(cpSpaceContainsBody(space, body), "Cannot remove a body that was not added to the space. (Removed twice maybe?)");
cpAssertSpaceUnlocked(space);
cpBodyActivate(body);
// cpSpaceFilterArbiters(space, body, NULL);
cpArrayDeleteObj(space->bodies, body);
body->space = NULL;
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:11,代码来源:cpSpace.c
示例7: cpSpaceRemoveBody
void
cpSpaceRemoveBody(cpSpace *space, cpBody *body)
{
cpAssertWarn(body->space == space,
"Cannot remove a body that was not added to the space. (Removed twice maybe?)");
cpAssertSpaceUnlocked(space);
cpBodyActivate(body);
cpArrayDeleteObj(space->bodies, body);
body->space = NULL;
}
开发者ID:harad,项目名称:Last-Escape,代码行数:11,代码来源:cpSpace.c
示例8: cpSpaceAddBody
cpBody *
cpSpaceAddBody(cpSpace *space, cpBody *body)
{
cpAssertHard(!cpBodyIsStatic(body), "Static bodies cannot be added to a space as they are not meant to be simulated.");
cpAssertSoft(!body->space, "This body is already added to a space and cannot be added to another.");
cpAssertSpaceUnlocked(space);
cpArrayPush(space->bodies, body);
body->space = space;
return body;
}
开发者ID:wdmchaft,项目名称:h5_drive,代码行数:12,代码来源:cpSpace.c
示例9: cpSpaceAddBody
cpBody *
cpSpaceAddBody(cpSpace *space, cpBody *body)
{
cpAssertHard(body->space != space, "You have already added this body to this space. You must not add it a second time.");
cpAssertHard(!body->space, "You have already added this body to another space. You cannot add it to a second.");
cpAssertSpaceUnlocked(space);
cpArrayPush(cpBodyIsDynamic(body) ? space->dynamicBodies : space->otherBodies, body);
body->space = space;
return body;
}
开发者ID:A1iAshoor,项目名称:SpeedJum,代码行数:12,代码来源:cpSpace.c
示例10: cpSpaceAddBody
cpBody *
cpSpaceAddBody(cpSpace *space, cpBody *body)
{
cpAssertHard(body->space != space, "You have already added this body to this space. You must not add it a second time.");
cpAssertHard(!body->space, "You have already added this body to another space. You cannot add it to a second.");
cpAssertSpaceUnlocked(space);
cpArrayPush(cpSpaceArrayForBodyType(space, cpBodyGetType(body)), body);
body->space = space;
return body;
}
开发者ID:SanLiangSan,项目名称:DDNoOneWrong,代码行数:12,代码来源:cpSpace.c
示例11: cpSpaceRemoveStaticShape
void
cpSpaceRemoveStaticShape(cpSpace *space, cpShape *shape)
{
cpAssertHard(cpSpaceContainsShape(space, shape), "Cannot remove a static or sleeping shape that was not added to the space. (Removed twice maybe?)");
cpAssertSpaceUnlocked(space);
cpBody *body = shape->body;
if(cpBodyIsStatic(body)) cpBodyActivateStatic(body, shape);
cpBodyRemoveShape(body, shape);
cpSpaceFilterArbiters(space, body, shape);
cpSpatialIndexRemove(space->staticShapes, shape, shape->hashid);
shape->space = NULL;
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:13,代码来源:cpSpace.c
示例12: cpSpaceAddBody
cpBody *
cpSpaceAddBody(cpSpace *space, cpBody *body)
{
cpAssertHard(!cpBodyIsStatic(body), "Do not add static bodies to a space. Static bodies do not move and should not be simulated.");
cpAssertHard(body->space != space, "You have already added this body to this space. You must not add it a second time.");
cpAssertHard(!body->space, "You have already added this body to another space. You cannot add it to a second.");
cpAssertSpaceUnlocked(space);
cpArrayPush(space->bodies, body);
body->space = space;
return body;
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:13,代码来源:cpSpace.c
示例13: cpSpaceRemoveStaticShape
void
cpSpaceRemoveStaticShape(cpSpace *space, cpShape *shape)
{
cpAssertWarn(cpHashSetFind(space->staticShapes->handleSet, shape->hashid, shape),
"Cannot remove a static or sleeping shape that was not added to the space. (Removed twice maybe?)");
cpAssertSpaceUnlocked(space);
removalContext context = {space, shape};
cpHashSetFilter(space->contactSet, (cpHashSetFilterFunc)contactSetFilterRemovedShape, &context);
cpSpaceHashRemove(space->staticShapes, shape, shape->hashid);
cpSpaceActivateShapesTouchingShape(space, shape);
}
开发者ID:harad,项目名称:Last-Escape,代码行数:13,代码来源:cpSpace.c
示例14: cpSpaceAddStaticShape
cpShape *
cpSpaceAddStaticShape(cpSpace *space, cpShape *shape)
{
cpAssertSoft(!shape->space, "This shape is already added to a space and cannot be added to another.");
cpAssertSpaceUnlocked(space);
cpBody *body = shape->body;
cpBodyAddShape(body, shape);
cpShapeUpdate(shape, body->p, body->rot);
cpSpatialIndexInsert(space->staticShapes, shape, shape->hashid);
shape->space = space;
return shape;
}
开发者ID:wdmchaft,项目名称:h5_drive,代码行数:14,代码来源:cpSpace.c
示例15: cpSpaceRemoveBody
void
cpSpaceRemoveBody(cpSpace *space, cpBody *body)
{
cpAssertHard(body != cpSpaceGetStaticBody(space), "Cannot remove the designated static body for the space.");
cpAssertHard(cpSpaceContainsBody(space, body), "Cannot remove a body that was not added to the space. (Removed twice maybe?)");
// cpAssertHard(body->shapeList == NULL, "Cannot remove a body from the space before removing the bodies attached to it.");
// cpAssertHard(body->constraintList == NULL, "Cannot remove a body from the space before removing the constraints attached to it.");
cpAssertSpaceUnlocked(space);
cpBodyActivate(body);
// cpSpaceFilterArbiters(space, body, NULL);
cpArrayDeleteObj(cpSpaceArrayForBodyType(space, cpBodyGetType(body)), body);
body->space = NULL;
}
开发者ID:SanLiangSan,项目名称:DDNoOneWrong,代码行数:14,代码来源:cpSpace.c
示例16: cpSpaceRemoveConstraint
void
cpSpaceRemoveConstraint(cpSpace *space, cpConstraint *constraint)
{
cpAssertHard(cpSpaceContainsConstraint(space, constraint), "Cannot remove a constraint that was not added to the space. (Removed twice maybe?)");
cpAssertSpaceUnlocked(space);
cpBodyActivate(constraint->a);
cpBodyActivate(constraint->b);
cpArrayDeleteObj(space->constraints, constraint);
cpBodyRemoveConstraint(constraint->a, constraint);
cpBodyRemoveConstraint(constraint->b, constraint);
constraint->space = NULL;
}
开发者ID:SanLiangSan,项目名称:DDNoOneWrong,代码行数:14,代码来源:cpSpace.c
示例17: cpSpaceAddStaticShape
cpShape *
cpSpaceAddStaticShape(cpSpace *space, cpShape *shape)
{
cpAssert(!cpHashSetFind(space->staticShapes->handleSet, shape->hashid, shape),
"Cannot add the same static shape more than once.");
cpAssertSpaceUnlocked(space);
if(!shape->body) shape->body = &space->staticBody;
cpShapeCacheBB(shape);
activateShapesTouchingShape(space, shape);
addShapeRaw(shape, space->staticShapes);
return shape;
}
开发者ID:bcolombini,项目名称:Learn-iPhone-and-iPad-cocos2d-Game-Development,代码行数:15,代码来源:cpSpace.c
示例18: cpSpaceAddStaticShape
cpShape *
cpSpaceAddStaticShape(cpSpace *space, cpShape *shape)
{
// cpAssert(shape->body, "Cannot add a static shape with a NULL body.");
if(!shape->body) shape->body = &space->staticBody;
cpAssert(!cpHashSetFind(space->staticShapes->handleSet, shape->hashid, shape),
"Cannot add the same static shape more than once.");
cpAssertSpaceUnlocked(space);
cpShapeCacheBB(shape);
cpSpaceHashInsert(space->staticShapes, shape, shape->hashid, shape->bb);
return shape;
}
开发者ID:rickystone,项目名称:TwilightGolf,代码行数:15,代码来源:cpSpace.c
示例19: cpSpaceAddStaticShape
cpShape *
cpSpaceAddStaticShape(cpSpace *space, cpShape *shape)
{
cpAssertHard(shape->space != space, "You have already added this shape to this space. You must not add it a second time.");
cpAssertHard(!shape->space, "You have already added this shape to another space. You cannot add it to a second.");
cpAssertHard(cpBodyIsRogue(shape->body), "You are adding a static shape to a dynamic body. Did you mean to attach it to a static or rogue body? See the documentation for more information.");
cpAssertSpaceUnlocked(space);
cpBody *body = shape->body;
cpBodyAddShape(body, shape);
cpShapeUpdate(shape, body->p, body->rot);
cpSpatialIndexInsert(space->staticShapes, shape, shape->hashid);
shape->space = space;
return shape;
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:16,代码来源:cpSpace.c
示例20: cpSpaceAddShape
cpShape *
cpSpaceAddShape(cpSpace *space, cpShape *shape)
{
cpBody *body = shape->body;
if(!body || body == &space->staticBody) return cpSpaceAddStaticShape(space, shape);
cpAssert(!cpHashSetFind(space->activeShapes->handleSet, shape->hashid, shape),
"Cannot add the same shape more than once.");
cpAssertSpaceUnlocked(space);
cpBodyActivate(body);
cpBodyAddShape(body, shape);
addShapeRaw(shape, space->activeShapes);
return shape;
}
开发者ID:bcolombini,项目名称:Learn-iPhone-and-iPad-cocos2d-Game-Development,代码行数:16,代码来源:cpSpace.c
注:本文中的cpAssertSpaceUnlocked函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论