PuzzleSDK
TMXOrthoVertexZ类 参考

#include <TileMapTest.h>

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

Public 成员函数

 CREATE_FUNC (TMXOrthoVertexZ)
 
 TMXOrthoVertexZ ()
 
virtual std::string title () const override
 
virtual std::string subtitle () const override
 
 ~TMXOrthoVertexZ ()
 
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.h253 行定义.

构造及析构函数说明

◆ TMXOrthoVertexZ()

TMXOrthoVertexZ::TMXOrthoVertexZ ( )

在文件 TileMapTest.cpp1114 行定义.

1115{
1116 auto map = TMXTiledMap::create("TileMaps/orthogonal-test-vertexz.tmx");
1117 addChild(map, 0, kTagTileMap);
1118
1119 Size CC_UNUSED s = map->getContentSize();
1120 CCLOG("ContentSize: %f, %f", s.width,s.height);
1121
1122 // because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you
1123 // can use any Sprite and it will work OK.
1124 auto layer = map->getLayer("trees");
1125 _tamara = layer->getTileAt(Vec2(0,11));
1126 CCLOG("%p vertexZ: %f", _tamara, _tamara->getPositionZ());
1127 _tamara->retain();
1128
1129 auto move = MoveBy::create(10, Vec2(400,450) * (1/CC_CONTENT_SCALE_FACTOR()));
1130 auto back = move->reverse();
1131 auto seq = Sequence::create(move, back,nullptr);
1132 _tamara->runAction( RepeatForever::create(seq));
1133
1134 schedule(CC_SCHEDULE_SELECTOR(TMXOrthoVertexZ::repositionSprite));
1135
1136}
@ kTagTileMap
Definition: TileMapTest.cpp:33
cocos2d::Sprite * _tamara
Definition: TileMapTest.h:255
void repositionSprite(float dt)

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

+ 函数调用图:

◆ ~TMXOrthoVertexZ()

TMXOrthoVertexZ::~TMXOrthoVertexZ ( )

在文件 TileMapTest.cpp1138 行定义.

1139{
1140 _tamara->release();
1141}

引用了 _tamara.

成员函数说明

◆ CREATE_FUNC()

TMXOrthoVertexZ::CREATE_FUNC ( TMXOrthoVertexZ  )

◆ onEnter()

void TMXOrthoVertexZ::onEnter ( )
overridevirtual

重载 TestCase .

在文件 TileMapTest.cpp1152 行定义.

1153{
1155
1156 // TIP: 2d projection should be used
1157 Director::getInstance()->setProjection(Director::Projection::_2D);
1158 Director::getInstance()->getRenderer()->setDepthTest(true);
1159 Director::getInstance()->getRenderer()->setDepthWrite(true);
1160
1161}
virtual void onEnter() override
Definition: BaseTest.cpp:430

引用了 TestCase::onEnter().

+ 函数调用图:

◆ onExit()

void TMXOrthoVertexZ::onExit ( )
overridevirtual

重载 TileDemo .

在文件 TileMapTest.cpp1163 行定义.

1164{
1165 // At exit use any other projection.
1166 Director::getInstance()->setProjection(Director::Projection::DEFAULT);
1167 Director::getInstance()->getRenderer()->setDepthTest(false);
1168 Director::getInstance()->getRenderer()->setDepthWrite(false);
1170}
virtual void onExit() override

引用了 TileDemo::onExit().

+ 函数调用图:

◆ repositionSprite()

void TMXOrthoVertexZ::repositionSprite ( float  dt)

在文件 TileMapTest.cpp1143 行定义.

1144{
1145 // tile height is 101x81
1146 // map size: 12x12
1147 auto p = _tamara->getPosition();
1148 p = CC_POINT_POINTS_TO_PIXELS(p);
1149 _tamara->setPositionZ( -( (p.y+81) /81) );
1150}

引用了 _tamara.

被这些函数引用 TMXOrthoVertexZ().

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

◆ subtitle()

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

重载 TileDemo .

在文件 TileMapTest.cpp1177 行定义.

1178{
1179 return "Sprite should hide behind the trees";
1180}

◆ title()

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

重载 TileDemo .

在文件 TileMapTest.cpp1172 行定义.

1173{
1174 return "TMX Ortho vertexZ";
1175}

类成员变量说明

◆ _tamara

cocos2d::Sprite* TMXOrthoVertexZ::_tamara
private

在文件 TileMapTest.h255 行定义.

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


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