cocos2d-x  3.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TMXMapInfo Class Reference

TMXMapInfo contains the information about the map like: More...

#include <CCTMXXMLParser.h>

Inheritance diagram for TMXMapInfo:
Ref SAXDelegator

Public Member Functions

 TMXMapInfo ()
virtual ~TMXMapInfo ()
bool initWithTMXFile (const std::string &tmxFile)
 initializes a TMX format with a tmx file More...
 
bool initWithXML (const std::string &tmxString, const std::string &resourcePath)
 initializes a TMX format with an XML string and a TMX resource path More...
 
bool parseXMLFile (const std::string &xmlFilename)
 initializes parsing of an XML file, either a tmx (Map) file or tsx (Tileset) file More...
 
bool parseXMLString (const std::string &xmlString)
ValueMapIntKeygetTileProperties ()
void setTileProperties (const ValueMapIntKey &tileProperties)
int getOrientation () const
 map orientation More...
 
void setOrientation (int orientation)
const SizegetMapSize () const
 map width & height More...
 
void setMapSize (const Size &mapSize)
const SizegetTileSize () const
 tiles width & height More...
 
void setTileSize (const Size &tileSize)
const Vector< TMXLayerInfo * > & getLayers () const
 Layers. More...
 
Vector< TMXLayerInfo * > & getLayers ()
void setLayers (const Vector< TMXLayerInfo * > &layers)
const Vector< TMXTilesetInfo * > & getTilesets () const
 tilesets More...
 
Vector< TMXTilesetInfo * > & getTilesets ()
void setTilesets (const Vector< TMXTilesetInfo * > &tilesets)
const Vector< TMXObjectGroup * > & getObjectGroups () const
 ObjectGroups. More...
 
Vector< TMXObjectGroup * > & getObjectGroups ()
void setObjectGroups (const Vector< TMXObjectGroup * > &groups)
int getParentElement () const
 parent element More...
 
void setParentElement (int element)
int getParentGID () const
 parent GID More...
 
void setParentGID (int gid)
int getLayerAttribs () const
 layer attribs More...
 
void setLayerAttribs (int layerAttribs)
bool isStoringCharacters () const
 is storing characters? More...
 
bool getStoringCharacters () const
void setStoringCharacters (bool storingCharacters)
const ValueMapgetProperties () const
 properties More...
 
ValueMapgetProperties ()
void setProperties (const ValueMap &properties)
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)
const std::string & getCurrentString () const
void setCurrentString (const std::string &currentString)
const std::string & getTMXFileName () const
void setTMXFileName (const std::string &fileName)
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
- Public Member Functions inherited from SAXDelegator
virtual ~SAXDelegator ()
var ~SAXDelegator ()
local ~SAXDelegator ()

Static Public Member Functions

static TMXMapInfocreate (const std::string &tmxFile)
 creates a TMX Format with a tmx file More...
 
static TMXMapInfocreateWithXML (const std::string &tmxString, const std::string &resourcePath)
 creates a TMX Format with an XML string and a TMX resource path More...
 
static TMXMapInfoformatWithTMXFile (const char *tmxFile)
 creates a TMX Format with a tmx file More...
 
static TMXMapInfoformatWithXML (const char *tmxString, const char *resourcePath)
 creates a TMX Format with an XML string and a TMX resource path More...
 

Protected Member Functions

void internalInit (const std::string &tmxFileName, const std::string &resourcePath)
- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 
 Ref ()
 Constructor. More...
 

Protected Attributes

int _orientation
 map orientation More...
 
Size _mapSize
 map width & height More...
 
Size _tileSize
 tiles width & height More...
 
Vector< TMXLayerInfo * > _layers
 Layers. More...
 
Vector< TMXTilesetInfo * > _tilesets
 tilesets More...
 
Vector< TMXObjectGroup * > _objectGroups
 ObjectGroups. More...
 
int _parentElement
 parent element More...
 
int _parentGID
 parent GID More...
 
int _layerAttribs
 layer attribs More...
 
bool _storingCharacters
 is storing characters? More...
 
ValueMap _properties
 properties More...
 
int _xmlTileIndex
 xml format tile index More...
 
std::string _TMXFileName
 tmx filename More...
 
std::string _resources
std::string _currentString
 current string More...
 
ValueMapIntKey _tileProperties
 tile properties More...
 
int _currentFirstGID
bool _recordFirstGID
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 
var _referenceCount
 count of references More...
 
local _referenceCount
 count of references More...
 

Detailed Description

TMXMapInfo contains the information about the map like:

  • Map orientation (hexagonal, isometric or orthogonal)
  • Tile size
  • Map size

And it also contains:

  • Layers (an array of TMXLayerInfo objects)
  • Tilesets (an array of TMXTilesetInfo objects)
  • ObjectGroups (an array of TMXObjectGroupInfo objects)

This information is obtained from the TMX file.

Constructor & Destructor Documentation

virtual ~TMXMapInfo ( )
virtual

Member Function Documentation

static TMXMapInfo* create ( const std::string &  tmxFile)
static

creates a TMX Format with a tmx file

static TMXMapInfo* createWithXML ( const std::string &  tmxString,
const std::string &  resourcePath 
)
static

creates a TMX Format with an XML string and a TMX resource path

void endElement ( void *  ctx,
const char *  name 
)
virtual

Implements SAXDelegator.

static TMXMapInfo*
formatWithTMXFile
( const char *  tmxFile)
inlinestatic

creates a TMX Format with a tmx file

static TMXMapInfo* formatWithXML ( const char *  tmxString,
const char *  resourcePath 
)
inlinestatic

creates a TMX Format with an XML string and a TMX resource path

const std::string& getCurrentString ( ) const
inline
int getLayerAttribs ( ) const
inline

layer attribs

const Vector<TMXLayerInfo*>
& getLayers
( ) const
inline

Layers.

Vector<TMXLayerInfo*>& getLayers ( )
inline
const Size& getMapSize ( ) const
inline

map width & height

const Vector<TMXObjectGroup*>
& getObjectGroups
( ) const
inline

ObjectGroups.

Vector<TMXObjectGroup*>
& getObjectGroups
( )
inline
int getOrientation ( ) const
inline

map orientation

int getParentElement ( ) const
inline

parent element

int getParentGID ( ) const
inline

parent GID

const ValueMap& getProperties ( ) const
inline

properties

ValueMap& getProperties ( )
inline
bool getStoringCharacters ( ) const
inline
ValueMapIntKey& getTileProperties ( )
inline
const Vector<TMXTilesetInfo*>
& getTilesets
( ) const
inline

tilesets

Vector<TMXTilesetInfo*>
& getTilesets
( )
inline
const Size& getTileSize ( ) const
inline

tiles width & height

const std::string& getTMXFileName ( ) const
inline
bool initWithTMXFile ( const std::string &  tmxFile)

initializes a TMX format with a tmx file

bool initWithXML ( const std::string &  tmxString,
const std::string &  resourcePath 
)

initializes a TMX format with an XML string and a TMX resource path

void internalInit ( const std::string &  tmxFileName,
const std::string &  resourcePath 
)
protected
bool isStoringCharacters ( ) const
inline

is storing characters?

bool parseXMLFile ( const std::string &  xmlFilename)

initializes parsing of an XML file, either a tmx (Map) file or tsx (Tileset) file

bool parseXMLString ( const std::string &  xmlString)
void setCurrentString ( const std::string &  currentString)
inline
void setLayerAttribs ( int  layerAttribs)
inline
void setLayers ( const Vector< TMXLayerInfo * > &  layers)
inline
void setMapSize ( const Size mapSize)
inline
void setObjectGroups ( const Vector< TMXObjectGroup * > &  groups)
inline
void setOrientation ( int  orientation)
inline
void setParentElement ( int  element)
inline
void setParentGID ( int  gid)
inline
void setProperties ( const ValueMap properties)
inline
void setStoringCharacters ( bool  storingCharacters)
inline
void setTileProperties ( const ValueMapIntKey tileProperties)
inline
void setTilesets ( const Vector< TMXTilesetInfo * > &  tilesets)
inline
void setTileSize ( const Size tileSize)
inline
void setTMXFileName ( const std::string &  fileName)
inline
void startElement ( void *  ctx,
const char *  name,
const char **  atts 
)
virtual

Implements SAXDelegator.

void textHandler ( void *  ctx,
const char *  ch,
int  len 
)
virtual

Implements SAXDelegator.

Member Data Documentation

int _currentFirstGID
protected
std::string _currentString
protected

current string

int _layerAttribs
protected

layer attribs

Vector<TMXLayerInfo*> _layers
protected

Layers.

Size _mapSize
protected

map width & height

Vector<TMXObjectGroup*>
_objectGroups
protected

ObjectGroups.

int _orientation
protected

map orientation

int _parentElement
protected

parent element

int _parentGID
protected

parent GID

ValueMap _properties
protected

properties

bool _recordFirstGID
protected
std::string _resources
protected
bool _storingCharacters
protected

is storing characters?

ValueMapIntKey _tileProperties
protected

tile properties

Vector<TMXTilesetInfo*> _tilesets
protected

tilesets

Size _tileSize
protected

tiles width & height

std::string _TMXFileName
protected

tmx filename

int _xmlTileIndex
protected

xml format tile index


The documentation for this class was generated from the following file: