PuzzleSDK
ClickAndMoveTestCase类 参考

#include <ClickAndMoveTest.h>

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

Public 成员函数

 CREATE_FUNC (ClickAndMoveTestCase)
 
 ClickAndMoveTestCase ()
 
bool onTouchBegan (cocos2d::Touch *touch, cocos2d::Event *event)
 
void onTouchEnded (cocos2d::Touch *touch, cocos2d::Event *event)
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual std::string title () const
 
virtual std::string subtitle () const
 
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
 
virtual void onEnter () override
 

额外继承的成员函数

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

详细描述

在文件 ClickAndMoveTest.h32 行定义.

构造及析构函数说明

◆ ClickAndMoveTestCase()

ClickAndMoveTestCase::ClickAndMoveTestCase ( )

在文件 ClickAndMoveTest.cpp40 行定义.

41{
42 auto listener = EventListenerTouchOneByOne::create();
43 listener->onTouchBegan = CC_CALLBACK_2(ClickAndMoveTestCase::onTouchBegan, this);
44 listener->onTouchEnded = CC_CALLBACK_2(ClickAndMoveTestCase::onTouchEnded, this);
45 _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
46
47 auto sprite = Sprite::create(s_pathGrossini);
48
49 auto layer = LayerColor::create(Color4B(255,255,0,255));
50 addChild(layer, -1);
51
52 addChild(sprite, 0, kTagSprite);
53 sprite->setPosition(20,150);
54
55 sprite->runAction( JumpTo::create(4, Vec2(300,48), 100, 4) );
56
57 layer->runAction( RepeatForever::create(
58 Sequence::create(
59 FadeIn::create(1),
60 FadeOut::create(1),
61 nullptr)
62 ));
63}
@ kTagSprite
bool onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *event)
void onTouchEnded(cocos2d::Touch *touch, cocos2d::Event *event)
static const char s_pathGrossini[]
Definition: testResource.h:28

引用了 kTagSprite, onTouchBegan(), onTouchEnded() , 以及 s_pathGrossini.

+ 函数调用图:

成员函数说明

◆ CREATE_FUNC()

ClickAndMoveTestCase::CREATE_FUNC ( ClickAndMoveTestCase  )

◆ onTouchBegan()

bool ClickAndMoveTestCase::onTouchBegan ( cocos2d::Touch *  touch,
cocos2d::Event *  event 
)

在文件 ClickAndMoveTest.cpp65 行定义.

66{
67 return true;
68}

被这些函数引用 ClickAndMoveTestCase().

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

◆ onTouchEnded()

void ClickAndMoveTestCase::onTouchEnded ( cocos2d::Touch *  touch,
cocos2d::Event *  event 
)

在文件 ClickAndMoveTest.cpp70 行定义.

71{
72 auto location = touch->getLocation();
73
74 auto s = getChildByTag(kTagSprite);
75 s->stopAllActions();
76 s->runAction( MoveTo::create(1, Vec2(location.x, location.y) ) );
77 float o = location.x - s->getPosition().x;
78 float a = location.y - s->getPosition().y;
79 float at = (float) CC_RADIANS_TO_DEGREES( atanf( o/a) );
80
81 if( a < 0 )
82 {
83 if( o < 0 )
84 at = 180 + fabs(at);
85 else
86 at = 180 - fabs(at);
87 }
88
89 s->runAction( RotateTo::create(1, at) );
90}

引用了 kTagSprite.

被这些函数引用 ClickAndMoveTestCase().

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

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