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


C++ PhysicsBody::init方法代码示例

本文整理汇总了C++中PhysicsBody::init方法的典型用法代码示例。如果您正苦于以下问题:C++ PhysicsBody::init方法的具体用法?C++ PhysicsBody::init怎么用?C++ PhysicsBody::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhysicsBody的用法示例。


在下文中一共展示了PhysicsBody::init方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: create

PhysicsBody* PhysicsBody::create()
{
    PhysicsBody* body = new PhysicsBody();
    if (body && body->init())
    {
        body->autorelease();
        return body;
    }
    
    CC_SAFE_DELETE(body);
    return nullptr;
}
开发者ID:highjin,项目名称:ProjectArthas,代码行数:12,代码来源:CCPhysicsBody.cpp

示例2: createBox

PhysicsBody* PhysicsBody::createBox(const Size& size, const PhysicsMaterial& material, const Vec2& offset)
{
    PhysicsBody* body = new PhysicsBody();
    if (body && body->init())
    {
        body->addShape(PhysicsShapeBox::create(size, material, offset));
        body->autorelease();
        return body;
    }
    
    CC_SAFE_DELETE(body);
    return nullptr;
}
开发者ID:highjin,项目名称:ProjectArthas,代码行数:13,代码来源:CCPhysicsBody.cpp

示例3: createPolygon

PhysicsBody* PhysicsBody::createPolygon(const Vec2* points, int count, const PhysicsMaterial& material, const Vec2& offset)
{
    PhysicsBody* body = new PhysicsBody();
    if (body && body->init())
    {
        body->addShape(PhysicsShapePolygon::create(points, count, material, offset));
        body->autorelease();
        return body;
    }
    
    CC_SAFE_DELETE(body);
    return nullptr;
}
开发者ID:highjin,项目名称:ProjectArthas,代码行数:13,代码来源:CCPhysicsBody.cpp

示例4: createPolygon

PhysicsBody* PhysicsBody::createPolygon(Point* points, int count, PhysicsMaterial material)
{
    PhysicsBody* body = new PhysicsBody();
    if (body && body->init())
    {
        body->addShape(PhysicsShapePolygon::create(points, count, material));
        body->autorelease();
        return body;
    }
    
    CC_SAFE_DELETE(body);
    return nullptr;
}
开发者ID:chling,项目名称:artemis,代码行数:13,代码来源:CCPhysicsBody.cpp

示例5: createCircle

PhysicsBody* PhysicsBody::createCircle(float radius, const PhysicsMaterial& material, const Vec2& offset)
{
    PhysicsBody* body = new PhysicsBody();
    if (body && body->init())
    {
        body->addShape(PhysicsShapeCircle::create(radius, material, offset));
        body->autorelease();
        return body;
    }
    
    CC_SAFE_DELETE(body);
    return nullptr;
}
开发者ID:highjin,项目名称:ProjectArthas,代码行数:13,代码来源:CCPhysicsBody.cpp

示例6: createBox

PhysicsBody* PhysicsBody::createBox(Size size, PhysicsMaterial material)
{
    PhysicsBody* body = new PhysicsBody();
    if (body && body->init())
    {
        body->addShape(PhysicsShapeBox::create(size, material));
        body->autorelease();
        return body;
    }
    
    CC_SAFE_DELETE(body);
    return nullptr;
}
开发者ID:chling,项目名称:artemis,代码行数:13,代码来源:CCPhysicsBody.cpp

示例7: createEdgeSegment

PhysicsBody* PhysicsBody::createEdgeSegment(const Vec2& a, const Vec2& b, const PhysicsMaterial& material, float border/* = 1*/)
{
    PhysicsBody* body = new PhysicsBody();
    if (body && body->init())
    {
        body->addShape(PhysicsShapeEdgeSegment::create(a, b, material, border));
        body->_dynamic = false;
        body->autorelease();
        return body;
    }
    
    CC_SAFE_DELETE(body);
    return nullptr;
}
开发者ID:highjin,项目名称:ProjectArthas,代码行数:14,代码来源:CCPhysicsBody.cpp

示例8: createEdgeChain

PhysicsBody* PhysicsBody::createEdgeChain(const Vec2* points, int count, const PhysicsMaterial& material, float border/* = 1*/)
{
    PhysicsBody* body = new PhysicsBody();
    if (body && body->init())
    {
        body->addShape(PhysicsShapeEdgeChain::create(points, count, material, border));
        body->_dynamic = false;
        body->autorelease();
        return body;
    }
    
    CC_SAFE_DELETE(body);
    
    return nullptr;
}
开发者ID:highjin,项目名称:ProjectArthas,代码行数:15,代码来源:CCPhysicsBody.cpp

示例9: createEdgeBox

PhysicsBody* PhysicsBody::createEdgeBox(const Size& size, const PhysicsMaterial& material, float border/* = 1*/, const Vec2& offset)
{
    PhysicsBody* body = new PhysicsBody();
    if (body && body->init())
    {
        body->addShape(PhysicsShapeEdgeBox::create(size, material, border, offset));
        body->_dynamic = false;
        body->autorelease();
        return body;
    }
    
    CC_SAFE_DELETE(body);
    
    return nullptr;
}
开发者ID:highjin,项目名称:ProjectArthas,代码行数:15,代码来源:CCPhysicsBody.cpp

示例10: createEdgeBox

PhysicsBody* PhysicsBody::createEdgeBox(Size size, PhysicsMaterial material, float border/* = 1*/)
{
    PhysicsBody* body = new PhysicsBody();
    if (body && body->init())
    {
        body->addShape(PhysicsShapeEdgeBox::create(size, material, border));
        body->_dynamic = false;
        body->autorelease();
        return body;
    }
    
    CC_SAFE_DELETE(body);
    
    return nullptr;
}
开发者ID:chling,项目名称:artemis,代码行数:15,代码来源:CCPhysicsBody.cpp

示例11: createEdgePolygon

PhysicsBody* PhysicsBody::createEdgePolygon(const Vec2* points, int count, const PhysicsMaterial& material, float border/* = 1*/)
{
    PhysicsBody* body = new (std::nothrow) PhysicsBody();
    if (body && body->init())
    {
        body->addShape(PhysicsShapeEdgePolygon::create(points, count, material, border));
        body->setDynamic(false);
        body->autorelease();
        return body;
    }
    
    CC_SAFE_DELETE(body);
    
    return nullptr;
}
开发者ID:bonlai,项目名称:3kaigame,代码行数:15,代码来源:CCPhysicsBody.cpp

示例12: create

PhysicsBody* PhysicsBody::create(float mass, float moment)
{
    PhysicsBody* body = new (std::nothrow) PhysicsBody();
    if (body)
    {
        body->_mass = mass;
        body->_massDefault = false;
        body->_moment = moment;
        body->_momentDefault = false;
        if (body->init())
        {
            body->autorelease();
            return body;
        }
    }
    
    CC_SAFE_DELETE(body);
    return nullptr;
    
}
开发者ID:bonlai,项目名称:3kaigame,代码行数:20,代码来源:CCPhysicsBody.cpp


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