add tile map staggered test

This commit is contained in:
Huabing.Xu 2014-10-11 15:09:58 +08:00
parent 0e1b680ab2
commit 55431d6a83
5 changed files with 57 additions and 0 deletions

View File

@ -30,6 +30,7 @@ static int sceneIdx = -1;
static std::function<Layer*()> createFunctions[] = {
CLN(TMXIsoZorder),
CLN(TMXOrthoZorder),
CLN(TMXStaggeredTest),
CLN(TMXIsoVertexZ),
CLN(TMXOrthoVertexZ),
CLN(TMXOrthoTest),
@ -318,6 +319,33 @@ std::string TMXOrthoTest::title() const
return "TMX Orthogonal test";
}
TMXStaggeredTest::TMXStaggeredTest()
{
auto map = TMXTiledMap::create("TileMaps/test-staggered.tmx");
addChild(map, 0, kTagTileMap);
}
void TMXStaggeredTest::onEnter()
{
TileDemo::onEnter();
Director::getInstance()->setProjection(Director::Projection::_3D);
}
void TMXStaggeredTest::onExit()
{
Director::getInstance()->setProjection(Director::Projection::DEFAULT);
TileDemo::onExit();
}
std::string TMXStaggeredTest::title() const
{
return "TMX Staggered test";
}
//------------------------------------------------------------------
//
// TMXOrthoTest2

View File

@ -48,6 +48,16 @@ public:
virtual void onExit() override;
};
class TMXStaggeredTest : public TileDemo
{
public:
TMXStaggeredTest(void);
virtual std::string title() const override;
virtual void onEnter() override;
virtual void onExit() override;
};
class TMXOrthoTest2 : public TileDemo
{
public:

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="staggered" width="3" height="3" tilewidth="127" tileheight="97">
<tileset firstgid="1" name="grass" tilewidth="127" tileheight="97">
<image source="grass.png" width="127" height="97"/>
</tileset>
<tileset firstgid="2" name="grass01" tilewidth="127" tileheight="97">
<image source="grass01.png" width="127" height="97"/>
</tileset>
<layer name="块层 1" width="3" height="3">
<data encoding="base64" compression="zlib">
eJxjZGBgYCSAAQDYAAo=
</data>
</layer>
<layer name="块层 2" width="3" height="3">
<data encoding="base64" compression="zlib">
eJxjYEAAJiSMDAAAnAAH
</data>
</layer>
</map>