mirror of https://github.com/axmolengine/axmol.git
add performance test
This commit is contained in:
parent
02363c2ae4
commit
7ee90b4114
|
@ -22,6 +22,9 @@ Layer *CreateAnimationLayer(int index)
|
|||
case TEST_ANIMATIONELEMENT:
|
||||
pLayer = new TestActionTimeline();
|
||||
break;
|
||||
case TEST_TIMELINE_PERFORMACE:
|
||||
pLayer = new TestTimelinePerformance();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -178,6 +181,7 @@ void ActionTimelineTestLayer::backCallback(Ref *pSender)
|
|||
s->release();
|
||||
}
|
||||
|
||||
// TestActionTimeline
|
||||
void TestActionTimeline::onEnter()
|
||||
{
|
||||
ActionTimelineTestLayer::onEnter();
|
||||
|
@ -190,8 +194,8 @@ void TestActionTimeline::onEnter()
|
|||
node->runAction(action);
|
||||
action->gotoFrameAndPlay(0, 60, true);
|
||||
|
||||
node->setScale(0.4f);
|
||||
node->setPosition(0,0);
|
||||
node->setScale(0.2f);
|
||||
node->setPosition(150,100);
|
||||
|
||||
addChild(node);
|
||||
}
|
||||
|
@ -200,3 +204,31 @@ std::string TestActionTimeline::title() const
|
|||
{
|
||||
return "Test ActionTimeline";
|
||||
}
|
||||
|
||||
|
||||
// TestTimelinePerformance
|
||||
void TestTimelinePerformance::onEnter()
|
||||
{
|
||||
ActionTimelineTestLayer::onEnter();
|
||||
|
||||
SpriteFrameCache::getInstance()->addSpriteFramesWithFile("armature/Cowboy0.plist", "armature/Cowboy0.png");
|
||||
|
||||
for (int i = 0; i< 100; i++)
|
||||
{
|
||||
Node* node = NodeReader::getInstance()->createNode("ActionTimeline/boy_1.ExportJson");
|
||||
ActionTimeline* action = ActionTimelineCache::getInstance()->createAction("ActionTimeline/boy_1.ExportJson");
|
||||
|
||||
node->runAction(action);
|
||||
action->gotoFrameAndPlay(0, 60, true);
|
||||
|
||||
node->setScale(0.2f);
|
||||
node->setPosition(-50+i*2,100);
|
||||
addChild(node);
|
||||
}
|
||||
}
|
||||
|
||||
std::string TestTimelinePerformance::title() const
|
||||
{
|
||||
return "Test ActionTimeline performance";
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ public:
|
|||
|
||||
enum {
|
||||
TEST_ANIMATIONELEMENT = 0,
|
||||
TEST_TIMELINE_PERFORMACE,
|
||||
|
||||
TEST_ANIMATION_LAYER_COUNT
|
||||
};
|
||||
|
@ -54,4 +55,11 @@ public:
|
|||
virtual std::string title() const override;
|
||||
};
|
||||
|
||||
class TestTimelinePerformance : public ActionTimelineTestLayer
|
||||
{
|
||||
public:
|
||||
virtual void onEnter();
|
||||
virtual std::string title() const override;
|
||||
};
|
||||
|
||||
#endif // __ANIMATION_SCENE_H__
|
|
@ -411,10 +411,10 @@ void TestPerformance::addArmature(int number)
|
|||
|
||||
Armature *armature = nullptr;
|
||||
armature = new Armature();
|
||||
armature->init("Knight_f/Knight");
|
||||
armature->init("Cowboy");
|
||||
armature->getAnimation()->playWithIndex(0);
|
||||
armature->setPosition(50 + armatureCount * 2, 150);
|
||||
armature->setScale(0.6f);
|
||||
armature->setScale(0.2f);
|
||||
addArmatureToParent(armature);
|
||||
armature->release();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue