PuzzleSDK
MotionStreakTest2类 参考

#include <MotionStreakTest.h>

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

Public 成员函数

 CREATE_FUNC (MotionStreakTest2)
 
virtual void onEnter () override
 
void onTouchesMoved (const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
 
virtual std::string title () const override
 
virtual std::string subtitle () const override
 
- Public 成员函数 继承自 MotionStreakTest
 MotionStreakTest ()
 
 ~MotionStreakTest ()
 
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.h61 行定义.

成员函数说明

◆ CREATE_FUNC()

MotionStreakTest2::CREATE_FUNC ( MotionStreakTest2  )

◆ onEnter()

void MotionStreakTest2::onEnter ( )
overridevirtual

重载 MotionStreakTest .

在文件 MotionStreakTest.cpp109 行定义.

110{
112
113 auto listener = EventListenerTouchAllAtOnce::create();
114 listener->onTouchesMoved = CC_CALLBACK_2(MotionStreakTest2::onTouchesMoved, this);
115 _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
116
117 _yjzTest([this,listener]()
118 {
119 listener->onTouchesBegan =
120 [this](const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event)
121 {
122 auto streak = this->_streak ;
123 streak->reset() ;
124 };
125
126 listener->onTouchesEnded =
127 [this](const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event)
128 {
129 auto streak = this->_streak ;
130 streak->reset() ;
131 };
132
133 listener->onTouchesCancelled =
134 [this](const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event)
135 {
136 auto streak = this->_streak ;
137 streak->reset() ;
138 };
139 });
140 auto s = Director::getInstance()->getWinSize();
141
142 // create the streak object and add it to the scene
143 _streak = MotionStreak::create(10, 3, 64, Color3B::WHITE, s_streak );
144 addChild(_streak);
145
146 _streak->setPosition( Vec2(s.width/2, s.height/2) );
147}
void onTouchesMoved(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
virtual void onEnter() override
cocos2d::MotionStreak * _streak
static const char s_streak[]
Definition: testResource.h:46

引用了 MotionStreakTest::_streak, MotionStreakTest::onEnter(), onTouchesMoved() , 以及 s_streak.

+ 函数调用图:

◆ onTouchesMoved()

void MotionStreakTest2::onTouchesMoved ( const std::vector< cocos2d::Touch * > &  touches,
cocos2d::Event *  event 
)

在文件 MotionStreakTest.cpp149 行定义.

150{
151 auto touchLocation = touches[0]->getLocation();
152
153 _streak->setPosition( touchLocation );
154}

引用了 MotionStreakTest::_streak.

被这些函数引用 onEnter().

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

◆ subtitle()

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

重载 MotionStreakTest .

在文件 MotionStreakTest.cpp161 行定义.

162{
163 return "Need Touch Movement";
164}

◆ title()

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

重载 MotionStreakTest .

在文件 MotionStreakTest.cpp156 行定义.

157{
158 return "MotionStreak test";
159}

类成员变量说明

◆ _root

cocos2d::Node* MotionStreakTest2::_root
protected

在文件 MotionStreakTest.h64 行定义.

◆ _target

cocos2d::Node* MotionStreakTest2::_target
protected

在文件 MotionStreakTest.h65 行定义.


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