本文整理汇总了C++中cpShapeFree函数的典型用法代码示例。如果您正苦于以下问题:C++ cpShapeFree函数的具体用法?C++ cpShapeFree怎么用?C++ cpShapeFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cpShapeFree函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: freeDll
void freeDll(void)
{
int i;
Variable *var;
//Poistettaan kaikki muuttujat
for (i = 1; i != mVariableHandler.mSize;i++)
{
var = mVariableHandler.mPtrArray[i];
if (var != NULL)
{
switch(var->mType)
{
case VarTypeBody:
cpBodyFree((cpBody*)var->mPtr);break;
case VarTypeShape:
cpShapeFree((cpShape*)var->mPtr);break;
case VarTypeConstraint:
cpConstraintFree((cpConstraint*)var->mPtr);break;
case VarTypeDataArray:
daFree((DataArray*)var->mPtr);break;
}
}
}
//Tuhotaan ne kaikki...
vhDestroy(&mVariableHandler);
cpSpaceDestroy(&mSpace);
mState = Unloaded;
}
开发者ID:Latexi95,项目名称:cbChipmunk,代码行数:32,代码来源:cbchipmunk.c
示例2: RemoveShape
static void RemoveShape(cpBody *body, cpShape *shape, void *data)
{
UNUSED(body);
cpSpace *s = data;
cpSpaceRemoveShape(s, shape);
cpShapeFree(shape);
}
开发者ID:gameblabla,项目名称:fallingtime,代码行数:7,代码来源:box.c
示例3: machinePositionToNumber
void MachineSystem::removePart(cpVect gridPosition)
{
int machineNum = machinePositionToNumber(gridPosition);
MachinePart *partToRemove = parts[machineNum];
if (partToRemove) {
cpBody *attachmentBody = partToRemove->getBody();
__block cpBody *pegBody = NULL;
cpBodyEachConstraint_b(attachmentBody, ^(cpConstraint *c) {
if (cpConstraintGetB(c) == attachmentBody) {
cpBody *otherBody = cpConstraintGetA(c); // the peg is always body A
if (cpBodyGetMass(otherBody) == INFINITY)
pegBody = otherBody;
}
});
assert(pegBody);
int nPegs = size.x * size.y;
// remove the attachments for this machine
for (int i=0; i<nPegs; i++) {
cpVect otherMachinePos = machineNumberToPosition(i);
detachMachines(gridPosition, otherMachinePos);
}
partToRemove->detachFromBody(pegBody);
cpBodyEachShape_b(pegBody, ^(cpShape *shape) {
cpSpaceRemoveStaticShape(space, shape);
cpShapeFree(shape);
});
开发者ID:thecodemaiden,项目名称:machine-generator,代码行数:33,代码来源:MachineSystem.cpp
示例4: cpBodyFree
GameObject::~GameObject()
{
m_resMgr.DeleteSprite(m_Sprite.ID);
if(m_pBody)
cpBodyFree(m_pBody);
if(m_pShape)
cpShapeFree(m_pShape);
}
开发者ID:twayfarer,项目名称:mirrors-lasers,代码行数:8,代码来源:GameObject.cpp
示例5: cleanup_tiles
/* A matching cleanup_tiles function to make sure
* we free the chipmunk resources we allocated during
* init_tiles(). Remember - Chipmunk2D is not doing any
* garbage collection and any time we call one of the New
* functions we need to match it with a corresponding Free
* call when we're done.
*/
static void cleanup_tiles(struct state* state)
{
for (size_t i = 0; i < MAX_TILES; i++) {
if (state->tiles[i].is_active) {
cpShapeFree(state->tiles[i].shape);
cpBodyFree(state->tiles[i].body);
}
}
}
开发者ID:rlofc,项目名称:cage,代码行数:16,代码来源:chipmunk.c
示例6: cpShapeFree
PhysicsShape::~PhysicsShape()
{
for (auto shape : _cpShapes)
{
s_physicsShapeMap.erase(shape);
cpShapeFree(shape);
}
}
开发者ID:kaiqinetwork,项目名称:cocos2d-x,代码行数:9,代码来源:CCPhysicsShape.cpp
示例7: postStepRemove
static void
postStepRemove(cpSpace *space, cpShape *shape, void *unused)
{
cpSpaceRemoveBody(space, shape->body);
cpSpaceRemoveShape(space, shape);
cpBodyFree(shape->body);
cpShapeFree(shape);
}
开发者ID:0w,项目名称:moai-dev,代码行数:9,代码来源:Sensors.c
示例8: cpShapeFree
ChipmunkTestLayer::~ChipmunkTestLayer()
{
// manually Free rogue shapes
for( int i=0;i<4;i++) {
cpShapeFree( _walls[i] );
}
cpSpaceFree( _space );
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:10,代码来源:ChipmunkTest.cpp
示例9: cpShapeFree
PhysicsShapeInfo::~PhysicsShapeInfo()
{
for (auto shape : _shapes)
{
auto it = _map.find(shape);
if (it != _map.end()) _map.erase(shape);
cpShapeFree(shape);
}
}
开发者ID:skatpgusskat,项目名称:December,代码行数:10,代码来源:CCPhysicsShapeInfo_chipmunk.cpp
示例10: remove_unused
static void remove_unused(void* s)
{
cpShape* shape = (cpShape*)s;
chipmunk_data* p = (chipmunk_data*)shape->data;
destroy_chipmunk_data(p, shape->body);
/* The player was marked as to be deleted. The player is freed here,
* to avoid concurrence problems if we delete somewhere else. */
cpSpaceRemoveShape(space, shape);
cpShapeFree(shape);
}
开发者ID:wormsparty,项目名称:beautiful-absurd-subtle,代码行数:12,代码来源:server.c
示例11: cpShapeFree
void GameScene::onExit()
{
Scene::onExit();
this->unscheduleUpdate();
for (auto& shape : shapes)
cpShapeFree(shape);
shapes.clear();
cpSpaceRemoveCollisionHandler(space, collisionTypeBall, collisionTypeWall);
cpSpaceFree(space);
}
开发者ID:NatWeiss,项目名称:RGP,代码行数:12,代码来源:GameScene.cpp
示例12: UnregisterFromSpace
void RigidBody2D::Destroy()
{
UnregisterFromSpace();
cpSpace* space = m_world->GetHandle();
for (cpShape* shape : m_shapes)
cpShapeFree(shape);
if (m_handle)
cpBodyFree(m_handle);
m_shapes.clear();
}
开发者ID:Gawaboumga,项目名称:NazaraEngine,代码行数:13,代码来源:RigidBody2D.cpp
示例13: cpShapeFree
ChipmunkTestLayer::~ChipmunkTestLayer()
{
#if CC_ENABLE_CHIPMUNK_INTEGRATION
// manually Free rogue shapes
for( int i=0;i<4;i++) {
cpShapeFree( _walls[i] );
}
cpSpaceFree( _space );
Device::setAccelerometerEnabled(false);
#endif
}
开发者ID:Ju2ender,项目名称:Cocos2d-JS-E,代码行数:13,代码来源:ChipmunkTest.cpp
示例14: cpv
bool CDynamics2DBoxEntity::MoveTo(const CVector3& c_position,
const CQuaternion& c_orientation,
bool b_check_only) {
SInt32 nCollision;
/* Check whether the box is movable or not */
if(m_cBoxEntity.GetEmbodiedEntity().IsMovable()) {
/* The box is movable */
/* Save body position and orientation */
cpVect tOldPos = m_ptBody->p;
cpFloat fOldA = m_ptBody->a;
/* Move the body to the desired position */
m_ptBody->p = cpv(c_position.GetX(), c_position.GetY());
CRadians cXAngle, cYAngle, cZAngle;
c_orientation.ToEulerAngles(cZAngle, cYAngle, cXAngle);
cpBodySetAngle(m_ptBody, cZAngle.GetValue());
/* Create a shape sensor to test the movement */
/* First construct the vertices */
CVector3 cHalfSize = m_cBoxEntity.GetSize() * 0.5f;
cpVect tVertices[] = {
cpv(-cHalfSize.GetX(), -cHalfSize.GetY()),
cpv(-cHalfSize.GetX(), cHalfSize.GetY()),
cpv( cHalfSize.GetX(), cHalfSize.GetY()),
cpv( cHalfSize.GetX(), -cHalfSize.GetY())
};
/* Then create the shape itself */
cpShape* ptTestShape = cpPolyShapeNew(m_ptBody,
4,
tVertices,
cpvzero);
/* Check if there is a collision */
nCollision = cpSpaceShapeQuery(m_cEngine.GetPhysicsSpace(), ptTestShape, NULL, NULL);
/* Dispose of the sensor shape */
cpShapeFree(ptTestShape);
if(b_check_only || nCollision) {
/* Restore old body state if there was a collision or
it was only a check for movement */
m_ptBody->p = tOldPos;
cpBodySetAngle(m_ptBody, fOldA);
}
else {
/* Update the active space hash if the movement is actual */
cpSpaceReindexShape(m_cEngine.GetPhysicsSpace(), m_ptShape);
}
}
else {
/* The box is not movable, so you can't move it :-) */
nCollision = 1;
}
/* The movement is allowed if there is no collision */
return !nCollision;
}
开发者ID:EduardoFF,项目名称:argos2-RoboNetSim,代码行数:51,代码来源:dynamics2d_box_entity.cpp
示例15: cpShapeFree
void GameInst::UnloadLevel()
{
// Clear blocks
for (auto it = m_blocks.begin(); it != m_blocks.end();)
{
m_Renderer.RemoveDrawableSprite((*it)->GetSprite());
delete *it;
it = m_blocks.erase(it);
}
//clear laser catchers
/*for (auto it = Catchers.begin(); it != Catchers.end();)
{
it = Catchers.erase(it);
m_Renderer.RemoveDrawableSprite((*it)->GetSprite());
}*/
//clear laser emitters
for (auto it = Emitters.begin(); it != Emitters.end();)
{
m_Renderer.RemoveDrawableSprite((*it)->GetSprite());
delete *it;
it = Emitters.erase(it);
}
//clear physworld
cpShapeFree(m_WorldBounds.Top);
cpShapeFree(m_WorldBounds.Bottom);
cpShapeFree(m_WorldBounds.Left);
cpShapeFree(m_WorldBounds.Right);
cpSpaceFree(m_pSpace);
//clear player
m_Renderer.RemoveDrawableSprite(m_pPlayer->GetSprite());
delete m_pPlayer;
m_pPlayer = NULL;
}
开发者ID:mileswhiticker,项目名称:mirrors-lasers,代码行数:37,代码来源:GameInst.cpp
示例16: cpShapeFree
void GameInst::UnloadLevel()
{
// Clear blocks
for (auto it = m_blocks.begin(); it != m_blocks.end();) {
it = m_blocks.erase(it);
}
// Clear laser sprites
for (auto it = m_laserSprites.begin(); it != m_laserSprites.end();)
{
m_Renderer.RemoveDrawableSprite(&(*it));
m_ResMgr.DeleteSprite((*it).ID);
it = m_laserSprites.erase(it);
}
//clear physworld
cpShapeFree(m_WorldBounds.Top);
cpShapeFree(m_WorldBounds.Bottom);
cpShapeFree(m_WorldBounds.Left);
cpShapeFree(m_WorldBounds.Right);
cpSpaceFree(m_pSpace);
//clear player
}
开发者ID:twayfarer,项目名称:mirrors-lasers,代码行数:24,代码来源:GameInst.cpp
示例17: cpBodyIsStatic
CDynamics2DSingleBodyObjectModel::~CDynamics2DSingleBodyObjectModel() {
bool bIsStatic = cpBodyIsStatic(m_ptBody);
/* Dispose of shapes */
for(cpShape* pt_shape = m_ptBody->shapeList;
pt_shape != NULL;
pt_shape = pt_shape->next) {
cpSpaceRemoveShape(GetDynamics2DEngine().GetPhysicsSpace(), pt_shape);
cpShapeFree(pt_shape);
}
/* Dispose of body */
if(! bIsStatic)
cpSpaceRemoveBody(GetDynamics2DEngine().GetPhysicsSpace(), m_ptBody);
cpBodyFree(m_ptBody);
/* Reindex space */
if(bIsStatic) cpSpaceReindexStatic(GetDynamics2DEngine().GetPhysicsSpace());
}
开发者ID:hoelzl,项目名称:argos3,代码行数:16,代码来源:dynamics2d_single_body_object_model.cpp
示例18: while
void TestColliderDetector::destroyCPBody(cpBody *body)
{
cpShape *shape = body->shapeList_private;
while(shape)
{
cpShape *temp = shape->next_private;
cpSpaceRemoveShape(space, shape);
cpShapeFree(shape);
shape = temp;
}
cpSpaceRemoveBody(space, body);
cpBodyFree(body);
}
开发者ID:chengstory,项目名称:CocoStudioSamples,代码行数:16,代码来源:TestColliderDetector.cpp
示例19: cpSpaceRemoveShape
void RigidBody2D::Destroy()
{
cpSpace* space = m_world->GetHandle();
for (cpShape* shape : m_shapes)
{
cpSpaceRemoveShape(space, shape);
cpShapeFree(shape);
}
if (m_handle)
{
cpSpaceRemoveBody(space, m_handle);
cpBodyFree(m_handle);
}
m_shapes.clear();
}
开发者ID:Ardakaniz,项目名称:NazaraEngine,代码行数:16,代码来源:RigidBody2D.cpp
示例20: cpBodyFree
GameObject::~GameObject()
{
if (m_body) {
cpBodyFree(m_body);
m_body = nullptr;
}
if (m_shape) {
cpSpaceRemoveStaticShape(m_space, m_shape);
cpShapeFree(m_shape);
m_shape = nullptr;
}
if (m_sprite) {
m_sprite->removeFromParent();
m_sprite = nullptr;
}
}
开发者ID:Marilynmontu,项目名称:ParkourCpp,代码行数:16,代码来源:GameObject.cpp
注:本文中的cpShapeFree函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论