PuzzleSDK
MotionStreakTest1类 参考

#include <MotionStreakTest.h>

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

Public 成员函数

 CREATE_FUNC (MotionStreakTest1)
 
virtual void onEnter () override
 
void onUpdate (float delta)
 
virtual std::string title () const override
 
- Public 成员函数 继承自 MotionStreakTest
 MotionStreakTest ()
 
 ~MotionStreakTest ()
 
virtual std::string subtitle () const override
 
void modeCallback (cocos2d::Ref *sender)
 
- 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
 

Protected 属性

cocos2d::Node * _root
 
cocos2d::Node * _target
 
- Protected 属性 继承自 MotionStreakTest
cocos2d::MotionStreak * _streak
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 

详细描述

在文件 MotionStreakTest.h48 行定义.

成员函数说明

◆ CREATE_FUNC()

MotionStreakTest1::CREATE_FUNC ( MotionStreakTest1  )

◆ onEnter()

void MotionStreakTest1::onEnter ( )
overridevirtual

重载 MotionStreakTest .

在文件 MotionStreakTest.cpp51 行定义.

52{
54
55 auto s = Director::getInstance()->getWinSize();
56
57 // the root object just rotates around
58 _root = Sprite::create(s_pathR1);
59 addChild(_root, 1);
60 _root->setPosition(Vec2(s.width/2, s.height/2));
61
62 // the target object is offset from root, and the streak is moved to follow it
63 _target = Sprite::create(s_pathR1);
64 _root->addChild(_target);
65 _target->setPosition(Vec2(s.width/4, 0.0f));
66
67 // create the streak object and add it to the scene
68 _streak = MotionStreak::create(2, 3, 32, Color3B::GREEN, s_streak);
69 addChild(_streak);
70 // schedule an update on each frame so we can synchronize the streak with the target
71 schedule(CC_SCHEDULE_SELECTOR(MotionStreakTest1::onUpdate));
72
73 auto a1 = RotateBy::create(2, 360);
74
75 auto action1 = RepeatForever::create(a1);
76 auto motion = MoveBy::create(2, Vec2(100,0) );
77 _root->runAction( RepeatForever::create(Sequence::create(motion, motion->reverse(), nullptr) ) );
78 _root->runAction( action1 );
79
80 auto colorAction = RepeatForever::create(Sequence::create(
81 TintTo::create(0.2f, 255, 0, 0),
82 TintTo::create(0.2f, 0, 255, 0),
83 TintTo::create(0.2f, 0, 0, 255),
84 TintTo::create(0.2f, 0, 255, 255),
85 TintTo::create(0.2f, 255, 255, 0),
86 TintTo::create(0.2f, 255, 0, 255),
87 TintTo::create(0.2f, 255, 255, 255),
88 nullptr));
89
90 _streak->runAction(colorAction);
91}
cocos2d::Node * _target
void onUpdate(float delta)
cocos2d::Node * _root
virtual void onEnter() override
cocos2d::MotionStreak * _streak
static const char s_streak[]
Definition: testResource.h:46
static const char s_pathR1[]
Definition: testResource.h:33

引用了 _root, MotionStreakTest::_streak, _target, MotionStreakTest::onEnter(), onUpdate(), s_pathR1 , 以及 s_streak.

+ 函数调用图:

◆ onUpdate()

void MotionStreakTest1::onUpdate ( float  delta)

在文件 MotionStreakTest.cpp93 行定义.

94{
95 _streak->setPosition( _target->convertToWorldSpace(Vec2::ZERO) );
96}

引用了 MotionStreakTest::_streak , 以及 _target.

被这些函数引用 onEnter().

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

◆ title()

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

重载 MotionStreakTest .

在文件 MotionStreakTest.cpp98 行定义.

99{
100 return "MotionStreak test 1";
101}

类成员变量说明

◆ _root

cocos2d::Node* MotionStreakTest1::_root
protected

在文件 MotionStreakTest.h51 行定义.

被这些函数引用 onEnter().

◆ _target

cocos2d::Node* MotionStreakTest1::_target
protected

在文件 MotionStreakTest.h52 行定义.

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


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