Beispiel #1
0
Armature *Armature::create(const char *name, Bone *parentBone)
{
    Armature *armature = new Armature();
    if (armature && armature->init(name, parentBone))
    {
        armature->autorelease();
        return armature;
    }
    CC_SAFE_DELETE(armature);
    return NULL;
}
Beispiel #2
0
Armature *Armature::create()
{
    Armature *armature = new Armature();
    if (armature && armature->init())
    {
        armature->autorelease();
        return armature;
    }
    CC_SAFE_DELETE(armature);
    return NULL;
}
Beispiel #3
0
Armature *Armature::create(const std::string& name, Bone *parentBone)
{
    Armature *armature = new Armature();
    if (armature && armature->init(name, parentBone))
    {
        armature->autorelease();
        return armature;
    }
    CC_SAFE_DELETE(armature);
    return nullptr;
}
Armature *Armature::create(const std::string& name)
{
    Armature *armature = new (std::nothrow) Armature();
    if (armature && armature->init(name))
    {
        armature->autorelease();
        return armature;
    }
    CC_SAFE_DELETE(armature);
    return nullptr;
}
Beispiel #5
0
void TestPerformance::addArmature(int number)
{
    for (int i = 0; i<number; i++)
    {
        armatureCount++;

        Armature *armature = nullptr;
        armature = new (std::nothrow) Armature();
        armature->init("Cowboy");
        armature->getAnimation()->playWithIndex(0);
        armature->setPosition(50 + armatureCount * 2, 150);
        armature->setScale(0.1f);
        addArmatureToParent(armature);
        armature->release();
    }

    refreshTitle();
}
Beispiel #6
0
void TestPerformance::update(float delta)
{
    frames ++;
    times += delta;

    if (frames / times > 58)
    {
        Armature *armature = NULL;
        armature = new Armature();
        armature->init("Knight_f/Knight");
        armature->getAnimation()->playByIndex(0);
        armature->setPosition(50 + armatureCount * 2, 150);
        armature->setScale(0.6f);
        addArmature(armature);
        armature->release();

        char pszCount[255];
        sprintf(pszCount, "%s %i", subtitle().c_str(), armatureCount);
        LabelTTF *label = (LabelTTF *)getChildByTag(10001);
        label->setString(pszCount);
    }
}