PuzzleSDK
TMXOrthoZorder类 参考

#include <TileMapTest.h>

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

Public 成员函数

 CREATE_FUNC (TMXOrthoZorder)
 
 TMXOrthoZorder ()
 
virtual std::string title () const override
 
virtual std::string subtitle () const override
 
virtual ~TMXOrthoZorder ()
 
void repositionSprite (float dt)
 
- Public 成员函数 继承自 TileDemo
 TileDemo ()
 
virtual ~TileDemo ()
 
virtual void onExit () override
 
void onTouchesMoved (const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
 
- 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
 
virtual void onEnter () override
 

Private 属性

cocos2d::Sprite * _tamara
 

额外继承的成员函数

- 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
 

详细描述

在文件 TileMapTest.h225 行定义.

构造及析构函数说明

◆ TMXOrthoZorder()

TMXOrthoZorder::TMXOrthoZorder ( )

在文件 TileMapTest.cpp978 行定义.

979{
980 auto map = TMXTiledMap::create("TileMaps/orthogonal-test-zorder.tmx");
981 addChild(map, 0, kTagTileMap);
982
983 Size CC_UNUSED s = map->getContentSize();
984 CCLOG("ContentSize: %f, %f", s.width,s.height);
985
986 _tamara = Sprite::create(s_pathSister1);
987 map->addChild(_tamara, (int)map->getChildren().size());
988 _tamara->retain();
989 _tamara->setAnchorPoint(Vec2(0.5f,0.0f));
990
991
992 auto move = MoveBy::create(10, Vec2(400.0f,450.0f));
993 auto back = move->reverse();
994 auto seq = Sequence::create(move, back,nullptr);
995 _tamara->runAction( RepeatForever::create(seq));
996
997 schedule( CC_SCHEDULE_SELECTOR(TMXOrthoZorder::repositionSprite));
998}
@ kTagTileMap
Definition: TileMapTest.cpp:33
void repositionSprite(float dt)
cocos2d::Sprite * _tamara
Definition: TileMapTest.h:227
static const char s_pathSister1[]
Definition: testResource.h:29

引用了 _tamara, kTagTileMap, repositionSprite() , 以及 s_pathSister1.

+ 函数调用图:

◆ ~TMXOrthoZorder()

TMXOrthoZorder::~TMXOrthoZorder ( )
virtual

在文件 TileMapTest.cpp1000 行定义.

1001{
1002 _tamara->release();
1003}

引用了 _tamara.

成员函数说明

◆ CREATE_FUNC()

TMXOrthoZorder::CREATE_FUNC ( TMXOrthoZorder  )

◆ repositionSprite()

void TMXOrthoZorder::repositionSprite ( float  dt)

在文件 TileMapTest.cpp1005 行定义.

1006{
1007 auto p = _tamara->getPosition();
1008 p = CC_POINT_POINTS_TO_PIXELS(p);
1009 auto map = getChildByTag(kTagTileMap);
1010
1011 // there are only 4 layers. (grass and 3 trees layers)
1012 // if tamara < 81, z=4
1013 // if tamara < 162, z=3
1014 // if tamara < 243,z=2
1015
1016 // -10: customization for this particular sample
1017 int newZ = 4 - ( (p.y-10) / 81);
1018 newZ = std::max(newZ,0);
1019
1020 map->reorderChild(_tamara, newZ);
1021}

引用了 _tamara , 以及 kTagTileMap.

被这些函数引用 TMXOrthoZorder().

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

◆ subtitle()

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

重载 TileDemo .

在文件 TileMapTest.cpp1028 行定义.

1029{
1030 return "Sprite should hide behind the trees";
1031}

◆ title()

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

重载 TileDemo .

在文件 TileMapTest.cpp1023 行定义.

1024{
1025 return "TMX Ortho Zorder";
1026}

类成员变量说明

◆ _tamara

cocos2d::Sprite* TMXOrthoZorder::_tamara
private

在文件 TileMapTest.h227 行定义.

被这些函数引用 repositionSprite(), TMXOrthoZorder() , 以及 ~TMXOrthoZorder().


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