本文整理汇总了C++中cpAssertHard函数的典型用法代码示例。如果您正苦于以下问题:C++ cpAssertHard函数的具体用法?C++ cpAssertHard怎么用?C++ cpAssertHard使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cpAssertHard函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cpPolyShapeGetVert
cpVect
cpPolyShapeGetVert(cpShape *shape, int idx)
{
cpAssertHard(shape->klass == &polyClass, "Shape is not a poly shape.");
cpAssertHard(0 <= idx && idx < cpPolyShapeGetNumVerts(shape), "Index out of range.");
return ((cpPolyShape *)shape)->verts[idx];
}
示例2: cpPolyShapeGetVert
cpVect
cpPolyShapeGetVert(const cpShape *shape, int i)
{
cpAssertHard(shape->klass == &polyClass, "Shape is not a poly shape.");
int count = cpPolyShapeGetCount(shape);
cpAssertHard(0 <= i && i < count, "Index out of range.");
return ((cpPolyShape *)shape)->planes[i + count].v0;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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.");
cpAssertHard(!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;
}
示例6: 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;
}
示例7: 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;
}
示例8: cpGearJointSetPhase
void
cpGearJointSetPhase(cpConstraint *constraint, cpFloat phase)
{
cpAssertHard(cpConstraintIsGearJoint(constraint), "Constraint is not a ratchet joint.");
cpConstraintActivateBodies(constraint);
((cpGearJoint *)constraint)->phase = phase;
}
示例9: cpDampedRotarySpringSetRestAngle
void
cpDampedRotarySpringSetRestAngle(cpConstraint *constraint, cpFloat restAngle)
{
cpAssertHard(cpConstraintIsDampedRotarySpring(constraint), "Constraint is not a damped rotary spring.");
cpConstraintActivateBodies(constraint);
((cpDampedRotarySpring *)constraint)->restAngle = restAngle;
}
示例10: cpDampedRotarySpringSetStiffness
void
cpDampedRotarySpringSetStiffness(cpConstraint *constraint, cpFloat stiffness)
{
cpAssertHard(cpConstraintIsDampedRotarySpring(constraint), "Constraint is not a damped rotary spring.");
cpConstraintActivateBodies(constraint);
((cpDampedRotarySpring *)constraint)->stiffness = stiffness;
}
示例11: cpArbiterGetPoint
cpVect
cpArbiterGetPoint(const cpArbiter *arb, int i)
{
cpAssertHard(0 <= i && i < arb->numContacts, "Index error: The specified contact index is invalid for this arbiter");
return arb->CP_PRIVATE(contacts)[i].CP_PRIVATE(p);
}
示例12: cpShapeSetElasticity
void
cpShapeSetElasticity(cpShape *shape, cpFloat elasticity)
{
cpAssertHard(elasticity >= 0.0f, "Elasticity must be positive and non-zero.");
cpBodyActivate(shape->body);
shape->e = elasticity;
}
示例13: cpPolyShapeSetVerts
void
cpPolyShapeSetVerts(cpShape *shape, int numVerts, cpVect *verts, cpVect offset)
{
cpAssertHard(shape->klass == &polyClass, "Shape is not a poly shape.");
cpPolyShapeDestroy((cpPolyShape *)shape);
setUpVerts((cpPolyShape *)shape, numVerts, verts, offset);
}
示例14: cpArbiterGetDepth
cpFloat
cpArbiterGetDepth(const cpArbiter *arb, int i)
{
cpAssertHard(0 <= i && i < cpArbiterGetCount(arb), "Index error: The specified contact index is invalid for this arbiter");
return arb->CP_PRIVATE(contacts)[i].CP_PRIVATE(dist);
}
示例15: cpConstraintSetErrorBias
void
cpConstraintSetErrorBias(cpConstraint *constraint, cpFloat errorBias)
{
cpAssertHard(errorBias >= 0.0f, "errorBias must be positive.");
cpConstraintActivateBodies(constraint);
constraint->errorBias = errorBias;
}