PuzzleSDK
LayerIgnoreAnchorPointScale类 参考

#include <LayerTest.h>

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

Public 成员函数

 CREATE_FUNC (LayerIgnoreAnchorPointScale)
 
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.h165 行定义.

成员函数说明

◆ CREATE_FUNC()

LayerIgnoreAnchorPointScale::CREATE_FUNC ( LayerIgnoreAnchorPointScale  )

◆ onEnter()

void LayerIgnoreAnchorPointScale::onEnter ( )
overridevirtual

重载 TestCase .

在文件 LayerTest.cpp704 行定义.

705{
707
708 auto s = Director::getInstance()->getWinSize();
709
710 auto l = LayerColor::create(Color4B(255, 0, 0, 255), 200, 200);
711
712 l->setAnchorPoint(Vec2(0.5f, 1.0f));
713 l->setPosition(Vec2( s.width/2, s.height/2));
714
715
716 auto scale = ScaleBy::create(2, 2);
717 auto back = (ScaleBy*)scale->reverse();
718 auto seq = Sequence::create(scale, back, nullptr);
719
720 l->runAction(RepeatForever::create(seq));
721
722 this->addChild(l, 0, kLayerIgnoreAnchorPoint);
723
724 auto child = Sprite::create("Images/grossini.png");
725 l->addChild(child);
726 auto lsize = l->getContentSize();
727 child->setPosition(Vec2(lsize.width/2, lsize.height/2));
728
729 auto item = MenuItemFont::create("Toggle ignore anchor point", CC_CALLBACK_1(LayerIgnoreAnchorPointScale::onToggle, this));
730
731 auto menu = Menu::create(item, nullptr);
732 this->addChild(menu);
733
734 menu->setPosition(Vec2(s.width/2, s.height/2));
735}
#define kLayerIgnoreAnchorPoint
Definition: LayerTest.cpp:606
void onToggle(cocos2d::Ref *pObject)
Definition: LayerTest.cpp:737
virtual void onEnter() override
Definition: BaseTest.cpp:430

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

+ 函数调用图:

◆ onToggle()

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

在文件 LayerTest.cpp737 行定义.

738{
739 auto layer = this->getChildByTag(kLayerIgnoreAnchorPoint);
740 bool ignore = layer->isIgnoreAnchorPointForPosition();
741 layer->setIgnoreAnchorPointForPosition(! ignore);
742}

引用了 kLayerIgnoreAnchorPoint.

被这些函数引用 onEnter().

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

◆ subtitle()

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

重载 TestCase .

在文件 LayerTest.cpp749 行定义.

750{
751 return "Ignoring Anchor Vec2 for scale";
752}

◆ title()

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

重载 LayerTest .

在文件 LayerTest.cpp744 行定义.

745{
746 return "IgnoreAnchorPoint - Scale";
747}

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