2011-06-14 14:31:25 +08:00
|
|
|
|
2012-02-02 14:26:38 +08:00
|
|
|
enum {
|
|
|
|
TMXLayerAttribNone = 1 << 0,
|
|
|
|
TMXLayerAttribBase64 = 1 << 1,
|
|
|
|
TMXLayerAttribGzip = 1 << 2,
|
|
|
|
TMXLayerAttribZlib = 1 << 3,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
TMXPropertyNone,
|
|
|
|
TMXPropertyMap,
|
|
|
|
TMXPropertyLayer,
|
|
|
|
TMXPropertyObjectGroup,
|
|
|
|
TMXPropertyObject,
|
|
|
|
TMXPropertyTile
|
|
|
|
};
|
|
|
|
|
2012-08-10 18:14:04 +08:00
|
|
|
typedef enum ccTMXTileFlags_ {
|
|
|
|
kCCTMXTileHorizontalFlag = 0x80000000,
|
|
|
|
kCCTMXTileVerticalFlag = 0x40000000,
|
|
|
|
kCCTMXTileDiagonalFlag = 0x20000000,
|
|
|
|
kCCFlipedAll = (kCCTMXTileHorizontalFlag|kCCTMXTileVerticalFlag|kCCTMXTileDiagonalFlag),
|
|
|
|
kCCFlippedMask = ~(kCCFlipedAll)
|
|
|
|
} ccTMXTileFlags;
|
|
|
|
|
2012-02-02 14:26:38 +08:00
|
|
|
class CCTMXLayerInfo : public CCObject
|
|
|
|
{
|
2012-04-26 14:32:17 +08:00
|
|
|
CCDictionary* getProperties();
|
|
|
|
void setProperties(CCDictionary* pval);
|
2012-02-02 14:26:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class CCTMXTilesetInfo : public CCObject
|
|
|
|
{
|
|
|
|
CCRect rectForGID(unsigned int gid);
|
|
|
|
};
|
|
|
|
|
|
|
|
class CCTMXMapInfo : public CCObject
|
|
|
|
{
|
|
|
|
void setOrientation(int val);
|
|
|
|
int getOrientation();
|
|
|
|
void setMapSize(CCSize sz);
|
|
|
|
CCSize getMapSize();
|
|
|
|
void setTileSize(CCSize sz);
|
|
|
|
CCSize getTileSize();
|
2012-04-26 14:32:17 +08:00
|
|
|
void setLayers(CCArray* pval);
|
|
|
|
CCArray* getLayers();
|
|
|
|
void setTilesets(CCArray* pval);
|
|
|
|
CCArray* getTilesets();
|
|
|
|
void setObjectGroups(CCArray* val);
|
|
|
|
CCArray* getObjectGroups();
|
2012-02-02 14:26:38 +08:00
|
|
|
void setParentElement(int val);
|
|
|
|
int getParentElement();
|
|
|
|
void setParentGID(unsigned int val);
|
|
|
|
unsigned int getParentGID();
|
|
|
|
void setLayerAttribs(int val);
|
|
|
|
int getLayerAttribs();
|
|
|
|
void setStoringCharacters(bool val);
|
|
|
|
bool getStoringCharacters();
|
2012-04-26 14:32:17 +08:00
|
|
|
void setProperties(CCDictionary* pval);
|
|
|
|
CCDictionary* getProperties();
|
|
|
|
void setTileProperties(CCDictionary* tileProperties);
|
|
|
|
CCDictionary* getTileProperties();
|
2012-02-02 14:26:38 +08:00
|
|
|
void setCurrentString(const char *currentString);
|
|
|
|
const char* getCurrentString();
|
|
|
|
void setTMXFileName(const char *fileName);
|
|
|
|
const char* getTMXFileName();
|
|
|
|
|
|
|
|
void startElement(void *ctx, const char *name, const char **atts);
|
|
|
|
void endElement(void *ctx, const char *name);
|
|
|
|
void textHandler(void *ctx, const char *ch, int len);
|
|
|
|
bool parseXMLFile(const char *xmlFilename);
|
2012-08-10 18:14:04 +08:00
|
|
|
bool parseXMLString(const char *xmlString);
|
2012-02-02 14:26:38 +08:00
|
|
|
|
|
|
|
static CCTMXMapInfo * formatWithTMXFile(const char *tmxFile);
|
2012-08-10 18:14:04 +08:00
|
|
|
static CCTMXMapInfo * formatWithXML(const char *tmxString, const char* resourcePath);
|
2012-02-02 14:26:38 +08:00
|
|
|
};
|