当前位置: 首页>>代码示例>>C++>>正文


C++ cpAssertHard函数代码示例

本文整理汇总了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];
}
开发者ID:pes6pro,项目名称:visva,代码行数:8,代码来源:cpPolyShape.c

示例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;
}
开发者ID:ConfusedReality,项目名称:pkg_game-engine_chipmunk,代码行数:10,代码来源:cpPolyShape.cpp

示例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;
}
开发者ID:SanLiangSan,项目名称:DDNoOneWrong,代码行数:12,代码来源:cpSpace.c

示例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;
}
开发者ID:A1iAshoor,项目名称:SpeedJum,代码行数:12,代码来源:cpSpace.c

示例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;
}
开发者ID:AntonioModer,项目名称:Cheetah,代码行数:12,代码来源:cpSpace.c

示例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;
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:13,代码来源:cpSpace.c

示例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;
}
开发者ID:SanLiangSan,项目名称:DDNoOneWrong,代码行数:14,代码来源:cpSpace.c

示例8: cpGearJointSetPhase

void
cpGearJointSetPhase(cpConstraint *constraint, cpFloat phase)
{
	cpAssertHard(cpConstraintIsGearJoint(constraint), "Constraint is not a ratchet joint.");
	cpConstraintActivateBodies(constraint);
	((cpGearJoint *)constraint)->phase = phase;
}
开发者ID:cxuhua,项目名称:cxengine,代码行数:7,代码来源:cpGearJoint.c

示例9: cpDampedRotarySpringSetRestAngle

void
cpDampedRotarySpringSetRestAngle(cpConstraint *constraint, cpFloat restAngle)
{
	cpAssertHard(cpConstraintIsDampedRotarySpring(constraint), "Constraint is not a damped rotary spring.");
	cpConstraintActivateBodies(constraint);
	((cpDampedRotarySpring *)constraint)->restAngle = restAngle;
}
开发者ID:00dazam,项目名称:FlappyBird-SpriteBuilder,代码行数:7,代码来源:cpDampedRotarySpring.c

示例10: cpDampedRotarySpringSetStiffness

void
cpDampedRotarySpringSetStiffness(cpConstraint *constraint, cpFloat stiffness)
{
	cpAssertHard(cpConstraintIsDampedRotarySpring(constraint), "Constraint is not a damped rotary spring.");
	cpConstraintActivateBodies(constraint);
	((cpDampedRotarySpring *)constraint)->stiffness = stiffness;
}
开发者ID:00dazam,项目名称:FlappyBird-SpriteBuilder,代码行数:7,代码来源:cpDampedRotarySpring.c

示例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);
}
开发者ID:CarterAppleton,项目名称:DTD-Lunar-Lander,代码行数:7,代码来源:cpArbiter.c

示例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;
}
开发者ID:azul3d-legacy,项目名称:native-cp,代码行数:7,代码来源:cpShape.c

示例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);
}
开发者ID:pes6pro,项目名称:visva,代码行数:7,代码来源:cpPolyShape.c

示例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);
}
开发者ID:604339917,项目名称:cocos2d-iphone,代码行数:7,代码来源:cpArbiter.c

示例15: cpConstraintSetErrorBias

void
cpConstraintSetErrorBias(cpConstraint *constraint, cpFloat errorBias)
{
	cpAssertHard(errorBias >= 0.0f, "errorBias must be positive.");
	cpConstraintActivateBodies(constraint);
	constraint->errorBias = errorBias;
}
开发者ID:cxuhua,项目名称:cxengine,代码行数:7,代码来源:cpConstraint.c


注:本文中的cpAssertHard函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。