PuzzleSDK
TMXIsoVertexZ类 参考

#include <TileMapTest.h>

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

Public 成员函数

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

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.h238 行定义.

构造及析构函数说明

◆ TMXIsoVertexZ()

TMXIsoVertexZ::TMXIsoVertexZ ( )

在文件 TileMapTest.cpp1039 行定义.

1040{
1041 auto map = TMXTiledMap::create("TileMaps/iso-test-vertexz.tmx");
1042 addChild(map, 0, kTagTileMap);
1043
1044 auto s = map->getContentSize();
1045 map->setPosition( Vec2(-s.width/2,0.0f) );
1046 CCLOG("ContentSize: %f, %f", s.width,s.height);
1047
1048 // because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you
1049 // can use any Sprite and it will work OK.
1050 auto layer = map->getLayer("Trees");
1051 _tamara = layer->getTileAt( Vec2(29,29) );
1052 _tamara->retain();
1053
1054 auto move = MoveBy::create(10, Vec2(300,250) * (1/CC_CONTENT_SCALE_FACTOR()));
1055 auto back = move->reverse();
1056 auto seq = Sequence::create(move, back,nullptr);
1057 _tamara->runAction( RepeatForever::create(seq) );
1058
1059 schedule( CC_SCHEDULE_SELECTOR(TMXIsoVertexZ::repositionSprite));
1060
1061}
@ kTagTileMap
Definition: TileMapTest.cpp:33
void repositionSprite(float dt)
cocos2d::Sprite * _tamara
Definition: TileMapTest.h:240

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

+ 函数调用图:

◆ ~TMXIsoVertexZ()

TMXIsoVertexZ::~TMXIsoVertexZ ( )

在文件 TileMapTest.cpp1063 行定义.

1064{
1065 _tamara->release();
1066}

引用了 _tamara.

成员函数说明

◆ CREATE_FUNC()

TMXIsoVertexZ::CREATE_FUNC ( TMXIsoVertexZ  )

◆ onEnter()

void TMXIsoVertexZ::onEnter ( )
overridevirtual

重载 TestCase .

在文件 TileMapTest.cpp1078 行定义.

1079{
1081
1082 // TIP: 2d projection should be used
1083 Director::getInstance()->setProjection(Director::Projection::_2D);
1084 Director::getInstance()->getRenderer()->setDepthTest(true);
1085 Director::getInstance()->getRenderer()->setDepthWrite(true);
1086}
virtual void onEnter() override
Definition: BaseTest.cpp:430

引用了 TestCase::onEnter().

+ 函数调用图:

◆ onExit()

void TMXIsoVertexZ::onExit ( )
overridevirtual

重载 TileDemo .

在文件 TileMapTest.cpp1088 行定义.

1089{
1090 // At exit use any other projection.
1091 Director::getInstance()->setProjection(Director::Projection::DEFAULT);
1092 Director::getInstance()->getRenderer()->setDepthTest(false);
1093 Director::getInstance()->getRenderer()->setDepthWrite(false);
1094
1096}
virtual void onExit() override

引用了 TileDemo::onExit().

+ 函数调用图:

◆ repositionSprite()

void TMXIsoVertexZ::repositionSprite ( float  dt)

在文件 TileMapTest.cpp1068 行定义.

1069{
1070 // tile height is 64x32
1071 // map size: 30x30
1072 auto p = _tamara->getPosition();
1073 p = CC_POINT_POINTS_TO_PIXELS(p);
1074 float newZ = -(p.y+32) /16;
1075 _tamara->setPositionZ( newZ );
1076}

引用了 _tamara.

被这些函数引用 TMXIsoVertexZ().

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

◆ subtitle()

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

重载 TileDemo .

在文件 TileMapTest.cpp1103 行定义.

1104{
1105 return "Sprite should hide behind the trees";
1106}

◆ title()

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

重载 TileDemo .

在文件 TileMapTest.cpp1098 行定义.

1099{
1100 return "TMX Iso VertexZ";
1101}

类成员变量说明

◆ _tamara

cocos2d::Sprite* TMXIsoVertexZ::_tamara
private

在文件 TileMapTest.h240 行定义.

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


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