PuzzleSDK
ActionAnimate类 参考

#include <ActionsTest.h>

+ 类 ActionAnimate 继承关系图:
+ ActionAnimate 的协作图:

Public 成员函数

 CREATE_FUNC (ActionAnimate)
 
virtual void onEnter () override
 
virtual void onExit () override
 
virtual std::string title () const override
 
virtual std::string subtitle () const override
 
- Public 成员函数 继承自 ActionsDemo
void centerSprites (unsigned int numberOfSprites)
 
void alignSpritesLeft (unsigned int numberOfSprites)
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual Type getTestType () const
 
virtual float getDuration () const
 
virtual std::string getExpectedOutput () const
 
virtual std::string getActualOutput () const
 
virtual void restartTestCallback (cocos2d::Ref *sender)
 
virtual void nextTestCallback (cocos2d::Ref *sender)
 
virtual void priorTestCallback (cocos2d::Ref *sender)
 
virtual void onBackCallback (cocos2d::Ref *sender)
 
void setTestSuite (TestSuite *testSuite)
 
TestSuitegetTestSuite () const
 
float getRunTime () const
 
void setTestCaseName (const std::string &name)
 
std::string getTestCaseName () const
 
const cocos2d::Label * getSubtitleLable () const
 
const cocos2d::MenuItemImage * getRestartTestItem () const
 

Private 属性

cocos2d::EventListenerCustom * _frameDisplayedListener
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 
- Protected 属性 继承自 ActionsDemo
cocos2d::Sprite * _grossini
 
cocos2d::Sprite * _tamara
 
cocos2d::Sprite * _kathia
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 ActionsTest.h175 行定义.

成员函数说明

◆ CREATE_FUNC()

ActionAnimate::CREATE_FUNC ( ActionAnimate  )

◆ onEnter()

void ActionAnimate::onEnter ( )
overridevirtual

重载 ActionsDemo .

在文件 ActionsTest.cpp639 行定义.

640{
642
643 centerSprites(3);
644
645 //
646 // Manual animation
647 //
648 auto animation = Animation::create();
649 for( int i=1;i<15;i++)
650 {
651 char szName[100] = {0};
652 sprintf(szName, "Images/grossini_dance_%02d.png", i);
653 animation->addSpriteFrameWithFile(szName);
654 }
655 // should last 2.8 seconds. And there are 14 frames.
656 animation->setDelayPerUnit(2.8f / 14.0f);
657 animation->setRestoreOriginalFrame(true);
658
659 auto action = Animate::create(animation);
660 _grossini->runAction(Sequence::create(action, action->reverse(), nullptr));
661
662 //
663 // File animation
664 //
665 // With 2 loops and reverse
666 auto cache = AnimationCache::getInstance();
667 cache->addAnimationsWithFile("animations/animations-2.plist");
668 auto animation2 = cache->getAnimation("dance_1");
669
670 auto action2 = Animate::create(animation2);
671 _tamara->runAction(Sequence::create(action2, action2->reverse(), nullptr));
672
673 _frameDisplayedListener = EventListenerCustom::create(AnimationFrameDisplayedNotification, [](EventCustom * event){
674 auto userData = static_cast<AnimationFrame::DisplayedEventInfo*>(event->getUserData());
675
676 log("target %p with data %s", userData->target, Value(userData->userInfo).getDescription().c_str());
677 });
678
679 _eventDispatcher->addEventListenerWithFixedPriority(_frameDisplayedListener, -1);
680
681 //
682 // File animation
683 //
684 // with 4 loops
685 auto animation3 = animation2->clone();
686 animation3->setLoops(4);
687
688
689 auto action3 = Animate::create(animation3);
690 _kathia->runAction(action3);
691}
cocos2d::EventListenerCustom * _frameDisplayedListener
Definition: ActionsTest.h:186
void centerSprites(unsigned int numberOfSprites)
cocos2d::Sprite * _grossini
Definition: ActionsTest.h:37
virtual void onEnter() override
cocos2d::Sprite * _tamara
Definition: ActionsTest.h:38
cocos2d::Sprite * _kathia
Definition: ActionsTest.h:39

引用了 _frameDisplayedListener, ActionsDemo::_grossini, ActionsDemo::_kathia, ActionsDemo::_tamara, ActionsDemo::centerSprites() , 以及 ActionsDemo::onEnter().

+ 函数调用图:

◆ onExit()

void ActionAnimate::onExit ( )
overridevirtual

重载 ActionsDemo .

在文件 ActionsTest.cpp693 行定义.

694{
696 _eventDispatcher->removeEventListener(_frameDisplayedListener);
697}
virtual void onExit() override

引用了 _frameDisplayedListener , 以及 ActionsDemo::onExit().

+ 函数调用图:

◆ subtitle()

std::string ActionAnimate::subtitle ( ) const
overridevirtual

重载 TestCase .

在文件 ActionsTest.cpp704 行定义.

705{
706 return "Center: Manual animation. Border: using file format animation";
707}

◆ title()

std::string ActionAnimate::title ( ) const
overridevirtual

重载 ActionsDemo .

在文件 ActionsTest.cpp699 行定义.

700{
701 return "Animation";
702}

类成员变量说明

◆ _frameDisplayedListener

cocos2d::EventListenerCustom* ActionAnimate::_frameDisplayedListener
private

在文件 ActionsTest.h186 行定义.

被这些函数引用 onEnter() , 以及 onExit().


该类的文档由以下文件生成: