PuzzleSDK
Bug914Layer类 参考

#include <Bug-914.h>

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

Public 成员函数

virtual bool init () override
 
virtual std::string title () const override
 
void onTouchesMoved (const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
 
void onTouchesBegan (const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
 
void restart (cocos2d::Ref *sender)
 
 CREATE_FUNC (Bug914Layer)
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
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
 

详细描述

在文件 Bug-914.h30 行定义.

成员函数说明

◆ CREATE_FUNC()

Bug914Layer::CREATE_FUNC ( Bug914Layer  )

◆ init()

bool Bug914Layer::init ( )
overridevirtual

在文件 Bug-914.cpp31 行定义.

32{
33 // always call "super" init
34 // Apple recommends to re-assign "self" with the "super" return value
35 if (BugsTestBase::init())
36 {
37 auto listener = EventListenerTouchAllAtOnce::create();
38 listener->onTouchesBegan = CC_CALLBACK_2(Bug914Layer::onTouchesBegan, this);
39 listener->onTouchesMoved = CC_CALLBACK_2(Bug914Layer::onTouchesMoved, this);
40 _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
41
42 // ask director the the window size
43 auto size = Director::getInstance()->getWinSize();
44 LayerColor *layer;
45 for( int i=0;i < 5;i++)
46 {
47 layer = LayerColor::create(Color4B(i*20, i*20, i*20,255));
48 layer->setContentSize(Size(i*100.0f, i*100.0f));
49 layer->setPosition(size.width/2, size.height/2);
50 layer->setAnchorPoint(Vec2(0.5f, 0.5f));
51 layer->setIgnoreAnchorPointForPosition(false);
52 addChild(layer, -1-i);
53 }
54
55 // create and initialize a Label
56 auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 64.0f);
57 auto item1 = MenuItemFont::create("restart", CC_CALLBACK_1(Bug914Layer::restart, this));
58
59 auto menu = Menu::create(item1, nullptr);
60 menu->alignItemsVertically();
61 menu->setPosition(size.width/2, 100);
62 addChild(menu);
63
64 // position the label on the center of the screen
65 label->setPosition(size.width /2 , size.height/2);
66
67 // add the label as a child to this Layer
68 addChild(label);
69 return true;
70 }
71 return false;
72}
void restart(cocos2d::Ref *sender)
Definition: Bug-914.cpp:84
void onTouchesMoved(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
Definition: Bug-914.cpp:74
void onTouchesBegan(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
Definition: Bug-914.cpp:79

引用了 onTouchesBegan(), onTouchesMoved() , 以及 restart().

+ 函数调用图:

◆ onTouchesBegan()

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

在文件 Bug-914.cpp79 行定义.

80{
81 onTouchesMoved(touches, event);
82}

引用了 onTouchesMoved().

被这些函数引用 init().

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

◆ onTouchesMoved()

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

在文件 Bug-914.cpp74 行定义.

75{
76 log("Number of touches: %d", (int)touches.size());
77}

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

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

◆ restart()

void Bug914Layer::restart ( cocos2d::Ref *  sender)

在文件 Bug-914.cpp84 行定义.

85{
86 Director::getInstance()->replaceScene(Bug914Layer::create());
87}

被这些函数引用 init().

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

◆ title()

virtual std::string Bug914Layer::title ( ) const
inlineoverridevirtual

重载 BugsTestBase .

在文件 Bug-914.h34 行定义.

34{ return "Bug914";}

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