PuzzleSDK
TMXIsoZorderNew类 参考

#include <TileMapTest2.h>

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

Public 成员函数

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

构造及析构函数说明

◆ TMXIsoZorderNew()

TMXIsoZorderNew::TMXIsoZorderNew ( )

在文件 TileMapTest2.cpp792 行定义.

793{
794 Director::getInstance()->getRenderer()->setDepthTest(false);
795 auto map = cocos2d::FastTMXTiledMap::create("TileMaps/iso-test-zorder.tmx");
796 addChild(map, 0, kTagTileMap);
797
798 auto s = map->getContentSize();
799 CCLOG("ContentSize: %f, %f", s.width,s.height);
800 map->setPosition(Vec2(-s.width/2,0.0f));
801
802 _tamara = Sprite::create(s_pathSister1);
803 map->addChild(_tamara, (int)map->getChildren().size() );
804 _tamara->retain();
805 int mapWidth = map->getMapSize().width * map->getTileSize().width;
806 _tamara->setPosition(CC_POINT_PIXELS_TO_POINTS(Vec2( mapWidth/2.0f,0.0f)));
807 _tamara->setAnchorPoint(Vec2(0.5f,0.0f));
808
809
810 auto move = MoveBy::create(10, Vec2(300.0f,250.0f));
811 auto back = move->reverse();
812 auto seq = Sequence::create(move, back,nullptr);
813 _tamara->runAction( RepeatForever::create(seq) );
814
815 schedule( CC_SCHEDULE_SELECTOR(TMXIsoZorderNew::repositionSprite) );
816}
@ kTagTileMap
void repositionSprite(float dt)
cocos2d::Sprite * _tamara
Definition: TileMapTest2.h:194
static const char s_pathSister1[]
Definition: testResource.h:29

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

+ 函数调用图:

◆ ~TMXIsoZorderNew()

TMXIsoZorderNew::~TMXIsoZorderNew ( )

在文件 TileMapTest2.cpp818 行定义.

819{
820 _tamara->release();
821}

引用了 _tamara.

成员函数说明

◆ CREATE_FUNC()

TMXIsoZorderNew::CREATE_FUNC ( TMXIsoZorderNew  )

◆ onExit()

void TMXIsoZorderNew::onExit ( )
overridevirtual

重载 TileDemoNew .

在文件 TileMapTest2.cpp823 行定义.

824{
825 unschedule(CC_SCHEDULE_SELECTOR(TMXIsoZorderNew::repositionSprite));
827}
virtual void onExit() override

引用了 TileDemoNew::onExit() , 以及 repositionSprite().

+ 函数调用图:

◆ repositionSprite()

void TMXIsoZorderNew::repositionSprite ( float  dt)

在文件 TileMapTest2.cpp829 行定义.

830{
831 auto p = _tamara->getPosition();
832 p = CC_POINT_POINTS_TO_PIXELS(p);
833 auto map = getChildByTag(kTagTileMap);
834
835 // there are only 4 layers. (grass and 3 trees layers)
836 // if tamara < 48, z=4
837 // if tamara < 96, z=3
838 // if tamara < 144,z=2
839
840 int newZ = 4 - (p.y / 48);
841 newZ = std::max(newZ,0);
842
843 map->reorderChild(_tamara, newZ);
844}

引用了 _tamara , 以及 kTagTileMap.

被这些函数引用 onExit() , 以及 TMXIsoZorderNew().

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

◆ subtitle()

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

重载 TileDemoNew .

在文件 TileMapTest2.cpp851 行定义.

852{
853 return "Sprite should hide behind the trees";
854}

◆ title()

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

重载 TileDemoNew .

在文件 TileMapTest2.cpp846 行定义.

847{
848 return "TMX Iso Zorder";
849}

类成员变量说明

◆ _tamara

cocos2d::Sprite* TMXIsoZorderNew::_tamara
private

在文件 TileMapTest2.h194 行定义.

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


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