PuzzleSDK
ActionCallFunction类 参考

#include <ActionsTest.h>

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

Public 成员函数

 CREATE_FUNC (ActionCallFunction)
 
virtual void onEnter () override
 
virtual std::string subtitle () const override
 
void callback1 ()
 
void callback2 (Node *pTarget)
 
void callback3 (Node *pTarget, long data)
 
- Public 成员函数 继承自 ActionsDemo
virtual void onExit () override
 
void centerSprites (unsigned int numberOfSprites)
 
void alignSpritesLeft (unsigned int numberOfSprites)
 
virtual std::string title () const override
 
- 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
 

额外继承的成员函数

- 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.h344 行定义.

成员函数说明

◆ callback1()

void ActionCallFunction::callback1 ( )

在文件 ActionsTest.cpp933 行定义.

934{
935 auto s = Director::getInstance()->getWinSize();
936 auto label = Label::createWithTTF("callback 1 called", "fonts/Marker Felt.ttf", 16.0f);
937 label->setPosition(s.width/4*1,s.height/2);
938
939 addChild(label);
940}

被这些函数引用 onEnter().

+ 这是这个函数的调用关系图:

◆ callback2()

void ActionCallFunction::callback2 ( Node *  pTarget)

在文件 ActionsTest.cpp942 行定义.

943{
944 auto s = Director::getInstance()->getWinSize();
945 auto label = Label::createWithTTF("callback 2 called", "fonts/Marker Felt.ttf", 16.0f);
946 label->setPosition(s.width/4*2,s.height/2);
947
948 addChild(label);
949
950 CCLOG("sender is: %p", sender);
951}

被这些函数引用 onEnter().

+ 这是这个函数的调用关系图:

◆ callback3()

void ActionCallFunction::callback3 ( Node *  pTarget,
long  data 
)

在文件 ActionsTest.cpp953 行定义.

954{
955 auto s = Director::getInstance()->getWinSize();
956 auto label = Label::createWithTTF("callback 3 called", "fonts/Marker Felt.ttf", 16.0f);
957 label->setPosition(s.width/4*3,s.height/2);
958 addChild(label);
959
960 CCLOG("target is: %p, data is: %ld", sender, data);
961}

被这些函数引用 onEnter().

+ 这是这个函数的调用关系图:

◆ CREATE_FUNC()

ActionCallFunction::CREATE_FUNC ( ActionCallFunction  )

◆ onEnter()

void ActionCallFunction::onEnter ( )
overridevirtual

重载 ActionsDemo .

在文件 ActionsTest.cpp895 行定义.

896{
898
899 centerSprites(3);
900
901
902 auto action1 = Sequence::create(
903 MoveBy::create(2, Vec2(200.0f,0.0f)),
904 CallFunc::create( std::bind(&ActionCallFunction::callback1, this) ),
905 CallFunc::create(
906 // lambda
907 [&](){
908 auto s = Director::getInstance()->getWinSize();
909 auto label = Label::createWithTTF("called:lambda callback", "fonts/Marker Felt.ttf", 16.0f);
910 label->setPosition(s.width/4*1,s.height/2-40);
911 this->addChild(label);
912 } ),
913 nullptr);
914
915 auto action2 = Sequence::create(
916 ScaleBy::create(2 , 2),
917 FadeOut::create(2),
918 CallFunc::create( std::bind(&ActionCallFunction::callback2, this, _tamara) ),
919 nullptr);
920
921 auto action3 = Sequence::create(
922 RotateBy::create(3 , 360),
923 FadeOut::create(2),
924 CallFunc::create( std::bind(&ActionCallFunction::callback3, this, _kathia, 42) ),
925 nullptr);
926
927 _grossini->runAction(action1);
928 _tamara->runAction(action2);
929 _kathia->runAction(action3);
930}
void callback3(Node *pTarget, long data)
void callback2(Node *pTarget)
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

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

+ 函数调用图:

◆ subtitle()

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

重载 TestCase .

在文件 ActionsTest.cpp963 行定义.

964{
965 return "Callbacks: CallFunc with std::function()";
966}

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