add TileMapTest code
This commit is contained in:
natural-law 2010-09-01 09:30:51 +00:00
parent ca6a97c4ac
commit b18e246eb9
10 changed files with 1565 additions and 1 deletions

View File

@ -35,7 +35,7 @@ namespace cocos2d {
typedef std::map<std::string, std::string> StringToStringDictionary;
typedef std::pair<std::string, std::string> StringToStringPair;
/** only used in StringToStringDictionary, return "" if not found*/
const char * valueForKey(std::string key, StringToStringDictionary *dict);
CCX_DLL const char * valueForKey(std::string key, StringToStringDictionary *dict);
/** CCTMXObjectGroup represents the TMX object group.
@since v0.99.0

View File

@ -0,0 +1 @@
112328fdb03b8966c8cb7b62a5fc51ce0d4570b1

View File

@ -0,0 +1 @@
263832e2766c734b77335f353e3066033c158c90

View File

@ -537,6 +537,18 @@
>
</File>
</Filter>
<Filter
Name="TileMapTest"
>
<File
RelativePath=".\tests\TileMapTest\TileMapTest.cpp"
>
</File>
<File
RelativePath=".\tests\TileMapTest\TileMapTest.h"
>
</File>
</Filter>
</Filter>
<File
RelativePath=".\test_uphoneUnicodeScript.h"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,240 @@
#ifndef _TILEMAP_TEST_H_
#define _TILEMAP_TEST_H_
#include "../testBasic.h"
class TileDemo : public CCLayer
{
protected:
CCLabel* m_label;
CCLabel* m_subtitle;
public:
TileDemo(void);
~TileDemo(void);
virtual std::string title();
virtual std::string subtitle();
virtual void onEnter();
void restartCallback(NSObject* pSender);
void nextCallback(NSObject* pSender);
void backCallback(NSObject* pSender);
void registerWithTouchDispatcher();
bool ccTouchBegan(CCTouch* touch, UIEvent* event);
void ccTouchEnded(CCTouch* touch, UIEvent* event);
void ccTouchCancelled(CCTouch* touch, UIEvent* event);
void ccTouchMoved(CCTouch* touch, UIEvent* event);
};
class TileMapTest : public TileDemo
{
public:
TileMapTest(void);
virtual std::string title();
};
class TileMapEditTest : public TileDemo
{
public:
TileMapEditTest (void);
virtual std::string title();
void updateMap(ccTime dt);
};
class TMXOrthoTest : public TileDemo
{
public:
TMXOrthoTest(void);
virtual std::string title();
virtual void onEnter();
virtual void onExit();
};
class TMXOrthoTest2 : public TileDemo
{
public:
TMXOrthoTest2(void);
virtual std::string title();
};
class TMXOrthoTest3 : public TileDemo
{
public:
TMXOrthoTest3(void);
virtual std::string title();
};
class TMXOrthoTest4 : public TileDemo
{
public:
TMXOrthoTest4(void);
void removeSprite(ccTime dt);
virtual std::string title();
};
class TMXReadWriteTest : public TileDemo
{
unsigned int m_gid;
unsigned int m_gid2;
public:
TMXReadWriteTest(void);
virtual std::string title();
void removeSprite(NSObject* sender);
void updateCol(ccTime dt);
void repaintWithGID(ccTime dt);
void removeTiles(ccTime dt);
};
class TMXHexTest : public TileDemo
{
public:
TMXHexTest(void);
virtual std::string title();
};
class TMXIsoTest : public TileDemo
{
public:
TMXIsoTest(void);
virtual std::string title();
};
class TMXIsoTest1 : public TileDemo
{
public:
TMXIsoTest1(void);
virtual std::string title();
};
class TMXIsoTest2 : public TileDemo
{
public:
TMXIsoTest2(void);
virtual std::string title();
};
class TMXUncompressedTest : public TileDemo
{
public:
TMXUncompressedTest(void);
virtual std::string title();
};
class TMXTilesetTest : public TileDemo
{
public:
TMXTilesetTest(void);
virtual std::string title();
};
class TMXOrthoObjectsTest : public TileDemo
{
public:
TMXOrthoObjectsTest(void);
virtual std::string title();
virtual void draw();
virtual std::string subtitle();
};
class TMXIsoObjectsTest : public TileDemo
{
public:
TMXIsoObjectsTest(void);
virtual std::string title();
virtual void draw();
virtual std::string subtitle();
};
class TMXResizeTest : public TileDemo
{
public:
TMXResizeTest(void);
virtual std::string title();
virtual std::string subtitle();
};
class TMXIsoZorder : public TileDemo
{
CCSprite* m_tamara;
public:
TMXIsoZorder(void);
virtual std::string title();
virtual std::string subtitle();
~TMXIsoZorder();
void repositionSprite(ccTime dt);
};
class TMXOrthoZorder : public TileDemo
{
CCSprite* m_tamara;
public:
TMXOrthoZorder(void);
virtual std::string title();
virtual std::string subtitle();
virtual ~TMXOrthoZorder();
void repositionSprite(ccTime dt);
};
class TMXIsoVertexZ : public TileDemo
{
CCSprite* m_tamara;
public:
TMXIsoVertexZ(void);
virtual std::string title();
virtual std::string subtitle();
~TMXIsoVertexZ();
void repositionSprite(ccTime dt);
virtual void onEnter();
virtual void onExit();
};
class TMXOrthoVertexZ : public TileDemo
{
CCSprite* m_tamara;
public:
TMXOrthoVertexZ(void);
virtual std::string title();
virtual std::string subtitle();
~TMXOrthoVertexZ();
void repositionSprite(ccTime dt);
virtual void onEnter();
virtual void onExit();
};
class TMXIsoMoveLayer : public TileDemo
{
public:
TMXIsoMoveLayer(void);
virtual std::string title();
virtual std::string subtitle();
};
class TMXOrthoMoveLayer : public TileDemo
{
public:
TMXOrthoMoveLayer(void);
virtual std::string title();
virtual std::string subtitle();
};
class TileMapTestScene : public TestScene
{
public:
virtual void runThisTest();
};
#endif

View File

@ -49,6 +49,10 @@ static TestScene* CreateTestScene(int nIdx)
pScene = new SceneTestScene(); break;
case TEST_PARALLAX:
pScene = new ParallaxTestScene(); break;
case TEST_TILE_MAP:
pScene = new TileMapTestScene(); break;
// case TEST_INTERVAL:
// pScene = new IntervalTestScene(); break;
default:
break;
}

View File

@ -37,5 +37,11 @@ static const char s_Power[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_test
// tilemaps resource
static const char s_TilesPng[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/TileMaps/tiles.png";
static const char s_LevelMapTga[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/TileMaps/levelmap.tga";
// static const char s_ISOVertexZ[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/TileMaps/iso-test-vertexz.tmx";
// static const char s_OrthTest1[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/TileMaps/orthogonal-test1.tmx";
// static const char s_OrthTest2[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/TileMaps/orthogonal-test2.tmx";
// static const char s_OrthTest3[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/TileMaps/orthogonal-test3.tmx";
// static const char s_OrthTest4[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/TileMaps/orthogonal-test4.tmx";
// static const char s_HexaTest[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/TileMaps/hexa-test.tmx";
#endif

View File

@ -18,6 +18,8 @@
#include "LayerTest/LayerTest.h"
#include "SceneTest/SceneTest.h"
#include "ParallaxTest/ParallaxTest.h"
#include "TileMapTest/TileMapTest.h"
//#include "IntervalTest/IntervalTest.h"
enum
{
@ -38,6 +40,8 @@ enum
TEST_LAYER,
TEST_SCENE,
TEST_PARALLAX,
TEST_TILE_MAP,
// TEST_INTERVAL,
TESTS_COUNT,
};
@ -59,6 +63,8 @@ const std::string g_aTestNames[TESTS_COUNT] = {
"LayerTest",
"SceneTest",
"ParallaxTest",
"TileMapTest",
// "IntervalTest",
};
#endif

View File

@ -1,7 +1,9 @@
mkdir D:\Work7\NEWPLUS\TDA_DATA\Data\cocos2d_tests\Images
mkdir D:\Work7\NEWPLUS\TDA_DATA\Data\cocos2d_tests\TileMaps
mkdir D:\Work7\NEWPLUS\TDA_DATA\UserData
copy .\Res\Images\*.* D:\Work7\NEWPLUS\TDA_DATA\Data\cocos2d_tests\Images
copy .\Res\TileMaps\*.* D:\Work7\NEWPLUS\TDA_DATA\Data\cocos2d_tests\TileMaps
copy .\Res\fonts\*.* D:\Work7\NEWPLUS\TDA_DATA\UserData
copy .\Res\Images\fire.png D:\Work7\NEWPLUS\TDA_DATA\UserData
copy .\Res\Images\fps_images.png D:\Work7\NEWPLUS\TDA_DATA\UserData
copy .\Res\Images\HelloWorld.png D:\Work7\NEWPLUS\TDA_DATA\UserData