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(); }
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); } }