PuzzleSDK
LayerTest1类 参考

#include <LayerTest.h>

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

Public 成员函数

 CREATE_FUNC (LayerTest1)
 
virtual void onEnter () override
 
virtual std::string subtitle () const override
 
void updateSize (cocos2d::Vec2 &touchLocation)
 
void onTouchesBegan (const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
 
void onTouchesMoved (const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
 
void onTouchesEnded (const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
 
- Public 成员函数 继承自 LayerTest
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 属性 继承自 LayerTest
std::string _title
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 LayerTest.h91 行定义.

成员函数说明

◆ CREATE_FUNC()

LayerTest1::CREATE_FUNC ( LayerTest1  )

◆ onEnter()

void LayerTest1::onEnter ( )
overridevirtual

重载 TestCase .

在文件 LayerTest.cpp387 行定义.

388{
390
391 auto listener = EventListenerTouchAllAtOnce::create();
392 listener->onTouchesBegan = CC_CALLBACK_2(LayerTest1::onTouchesBegan, this);
393 listener->onTouchesMoved = CC_CALLBACK_2(LayerTest1::onTouchesMoved, this);
394 listener->onTouchesEnded = CC_CALLBACK_2(LayerTest1::onTouchesEnded, this);
395
396 _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
397
398 auto s = Director::getInstance()->getWinSize();
399 auto layer = LayerColor::create( Color4B(0xFF, 0x00, 0x00, 0x80), 200, 200);
400
401 layer->setIgnoreAnchorPointForPosition(false);
402 layer->setPosition( Vec2(s.width/2, s.height/2) );
403 addChild(layer, 1, kTagLayer);
404}
@ kTagLayer
Definition: LayerTest.cpp:33
void onTouchesMoved(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
Definition: LayerTest.cpp:422
void onTouchesEnded(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
Definition: LayerTest.cpp:429
void onTouchesBegan(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
Definition: LayerTest.cpp:417
virtual void onEnter() override
Definition: BaseTest.cpp:430

引用了 kTagLayer, TestCase::onEnter(), onTouchesBegan(), onTouchesEnded() , 以及 onTouchesMoved().

+ 函数调用图:

◆ onTouchesBegan()

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

在文件 LayerTest.cpp417 行定义.

418{
419 onTouchesMoved(touches, event);
420}

引用了 onTouchesMoved().

被这些函数引用 onEnter().

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

◆ onTouchesEnded()

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

在文件 LayerTest.cpp429 行定义.

430{
431 onTouchesMoved(touches, event);
432}

引用了 onTouchesMoved().

被这些函数引用 onEnter().

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

◆ onTouchesMoved()

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

在文件 LayerTest.cpp422 行定义.

423{
424 auto touchLocation = touches[0]->getLocation();
425
426 updateSize(touchLocation);
427}
void updateSize(cocos2d::Vec2 &touchLocation)
Definition: LayerTest.cpp:406

引用了 updateSize().

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

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

◆ subtitle()

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

重载 TestCase .

在文件 LayerTest.cpp434 行定义.

435{
436 return "ColorLayer resize (tap & move)";
437}

◆ updateSize()

void LayerTest1::updateSize ( cocos2d::Vec2 &  touchLocation)

在文件 LayerTest.cpp406 行定义.

407{
408 auto s = Director::getInstance()->getWinSize();
409
410 auto newSize = Size( fabs(touchLocation.x - s.width/2)*2, fabs(touchLocation.y - s.height/2)*2);
411
412 auto l = (LayerColor*) getChildByTag(kTagLayer);
413
414 l->setContentSize( newSize );
415}

引用了 kTagLayer.

被这些函数引用 onTouchesMoved().

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

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