PuzzleSDK
LayerIgnoreAnchorPointPos类 参考

#include <LayerTest.h>

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

Public 成员函数

 CREATE_FUNC (LayerIgnoreAnchorPointPos)
 
virtual void onEnter () override
 
void onToggle (cocos2d::Ref *pObject)
 
virtual std::string title () const override
 
virtual std::string subtitle () 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.h145 行定义.

成员函数说明

◆ CREATE_FUNC()

LayerIgnoreAnchorPointPos::CREATE_FUNC ( LayerIgnoreAnchorPointPos  )

◆ onEnter()

void LayerIgnoreAnchorPointPos::onEnter ( )
overridevirtual

重载 TestCase .

在文件 LayerTest.cpp608 行定义.

609{
611
612 auto s = Director::getInstance()->getWinSize();
613
614 auto l = LayerColor::create(Color4B(255, 0, 0, 255), 150, 150);
615
616 l->setAnchorPoint(Vec2(0.5f, 0.5f));
617 l->setPosition(Vec2( s.width/2, s.height/2));
618
619 auto move = MoveBy::create(2, Vec2(100,2));
620 auto back = (MoveBy *)move->reverse();
621 auto seq = Sequence::create(move, back, nullptr);
622 l->runAction(RepeatForever::create(seq));
623 this->addChild(l, 0, kLayerIgnoreAnchorPoint);
624
625 auto child = Sprite::create("Images/grossini.png");
626 l->addChild(child);
627 auto lsize = l->getContentSize();
628 child->setPosition(Vec2(lsize.width/2, lsize.height/2));
629
630 auto item = MenuItemFont::create("Toggle ignore anchor point", CC_CALLBACK_1(LayerIgnoreAnchorPointPos::onToggle, this));
631
632 auto menu = Menu::create(item, nullptr);
633 this->addChild(menu);
634
635 menu->setPosition(Vec2(s.width/2, s.height/2));
636}
#define kLayerIgnoreAnchorPoint
Definition: LayerTest.cpp:606
void onToggle(cocos2d::Ref *pObject)
Definition: LayerTest.cpp:638
virtual void onEnter() override
Definition: BaseTest.cpp:430

引用了 kLayerIgnoreAnchorPoint, TestCase::onEnter() , 以及 onToggle().

+ 函数调用图:

◆ onToggle()

void LayerIgnoreAnchorPointPos::onToggle ( cocos2d::Ref *  pObject)

在文件 LayerTest.cpp638 行定义.

639{
640 auto layer = this->getChildByTag(kLayerIgnoreAnchorPoint);
641 bool ignore = layer->isIgnoreAnchorPointForPosition();
642 layer->setIgnoreAnchorPointForPosition(! ignore);
643}

引用了 kLayerIgnoreAnchorPoint.

被这些函数引用 onEnter().

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

◆ subtitle()

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

重载 TestCase .

在文件 LayerTest.cpp650 行定义.

651{
652 return "Ignoring Anchor Vec2 for position";
653}

◆ title()

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

重载 LayerTest .

在文件 LayerTest.cpp645 行定义.

646{
647 return "IgnoreAnchorPoint - Position";
648}

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