PuzzleSDK
TMXOrthoZorderNew类 参考

#include <TileMapTest2.h>

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

Public 成员函数

 CREATE_FUNC (TMXOrthoZorderNew)
 
 TMXOrthoZorderNew ()
 
virtual std::string title () const override
 
virtual std::string subtitle () const override
 
virtual ~TMXOrthoZorderNew ()
 
void repositionSprite (float dt)
 
- Public 成员函数 继承自 TileDemoNew
 TileDemoNew ()
 
virtual ~TileDemoNew ()
 
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
 

详细描述

在文件 TileMapTest2.h206 行定义.

构造及析构函数说明

◆ TMXOrthoZorderNew()

TMXOrthoZorderNew::TMXOrthoZorderNew ( )

在文件 TileMapTest2.cpp862 行定义.

863{
864 auto map = cocos2d::FastTMXTiledMap::create("TileMaps/orthogonal-test-zorder.tmx");
865 addChild(map, 0, kTagTileMap);
866
867 Size CC_UNUSED s = map->getContentSize();
868 CCLOG("ContentSize: %f, %f", s.width,s.height);
869
870 _tamara = Sprite::create(s_pathSister1);
871 map->addChild(_tamara, (int)map->getChildren().size());
872 _tamara->retain();
873 _tamara->setAnchorPoint(Vec2(0.5f,0.0f));
874
875
876 auto move = MoveBy::create(10, Vec2(400.0f,450.0f));
877 auto back = move->reverse();
878 auto seq = Sequence::create(move, back,nullptr);
879 _tamara->runAction( RepeatForever::create(seq));
880
881 schedule( CC_SCHEDULE_SELECTOR(TMXOrthoZorderNew::repositionSprite));
882}
@ kTagTileMap
void repositionSprite(float dt)
cocos2d::Sprite * _tamara
Definition: TileMapTest2.h:208
static const char s_pathSister1[]
Definition: testResource.h:29

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

+ 函数调用图:

◆ ~TMXOrthoZorderNew()

TMXOrthoZorderNew::~TMXOrthoZorderNew ( )
virtual

在文件 TileMapTest2.cpp884 行定义.

885{
886 _tamara->release();
887}

引用了 _tamara.

成员函数说明

◆ CREATE_FUNC()

TMXOrthoZorderNew::CREATE_FUNC ( TMXOrthoZorderNew  )

◆ repositionSprite()

void TMXOrthoZorderNew::repositionSprite ( float  dt)

在文件 TileMapTest2.cpp889 行定义.

890{
891 auto p = _tamara->getPosition();
892 p = CC_POINT_POINTS_TO_PIXELS(p);
893 auto map = getChildByTag(kTagTileMap);
894
895 // there are only 4 layers. (grass and 3 trees layers)
896 // if tamara < 81, z=4
897 // if tamara < 162, z=3
898 // if tamara < 243,z=2
899
900 // -10: customization for this particular sample
901 int newZ = 4 - ( (p.y-10) / 81);
902 newZ = std::max(newZ,0);
903
904 map->reorderChild(_tamara, newZ);
905}

引用了 _tamara , 以及 kTagTileMap.

被这些函数引用 TMXOrthoZorderNew().

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

◆ subtitle()

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

重载 TileDemoNew .

在文件 TileMapTest2.cpp912 行定义.

913{
914 return "Sprite should hide behind the trees";
915}

◆ title()

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

重载 TileDemoNew .

在文件 TileMapTest2.cpp907 行定义.

908{
909 return "TMX Ortho Zorder";
910}

类成员变量说明

◆ _tamara

cocos2d::Sprite* TMXOrthoZorderNew::_tamara
private

在文件 TileMapTest2.h208 行定义.

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


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