Class cc.TMXMapInfo
- Defined in: CCTMXXMLParser.js
- Extends cc.saxParser
Constructor Attributes | Constructor Name and Description |
---|---|
cc.TMXMapInfo contains the information about the map like: And it also contains: This information is obtained from the TMX file. |
Method Summary
Class Detail
cc.TMXMapInfo()
cc.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.
Field Detail
{String}
currentString
- Current string stored from characters stream.
{Object}
layerAttrs
- Layer attributes.
{Number}
mapHeight
- Height of the map
{Number}
mapWidth
- Width of the map
{Number}
orientation
- Map orientation.
{Object}
parentElement
- Parent element.
{Number}
parentGID
- Parent GID.
{Array}
properties
- Properties of the map info.
{Boolean}
storingCharacters
- Is reading storing characters stream.
{Number}
tileHeight
- Height of a tile
{Number}
tileWidth
- Width of a tile
{String}
tmxFileName
- TMX file name.
Method Detail
-
Creates a TMX Format with a tmx file or content string
1. //create a TMXMapInfo with file name var tmxMapInfo = cc.TMXMapInfo.create("res/orthogonal-test1.tmx"); 2. //create a TMXMapInfo with content string and resource path var resources = "res/TileMaps"; var filePath = "res/TileMaps/orthogonal-test1.tmx"; var xmlStr = cc.loader.getRes(filePath); var tmxMapInfo = cc.TMXMapInfo.create(xmlStr, resources);
- Parameters:
- {String} tmxFile
- fileName or content string
- {String} resourcePath
- If tmxFile is a file name ,it is not required.If tmxFile is content string ,it is must required.
- Returns:
- {cc.TMXMapInfo}
-
{String} getCurrentString()
- Returns:
- {String}
-
{Object} getLayerAttribs()Layer attribute
- Returns:
- {Object}
-
{Array} getLayers()Layers
- Returns:
- {Array}
-
{cc.Size} getMapSize()Map width & height
- Returns:
- {cc.Size}
-
{Array} getObjectGroups()ObjectGroups
- Returns:
- {Array}
-
{Number} getOrientation()
- Returns:
- {Number}
-
{Object} getParentElement()parent element
- Returns:
- {Object}
-
{Number} getParentGID()parent GID
- Returns:
- {Number}
-
{Array} getProperties()Properties
- Returns:
- {Array}
-
{Boolean} getStoringCharacters()Is reading storing characters stream
- Returns:
- {Boolean}
-
{object} getTileProperties()
- Returns:
- {object}
-
{Array} getTilesets()tilesets
- Returns:
- {Array}
-
{cc.Size} getTileSize()Tiles width & height
- Returns:
- {cc.Size}
-
{String} getTMXFileName()
- Returns:
- {String}
-
{Element} initWithTMXFile(tmxFile)Initializes a TMX format with a tmx file
- Parameters:
- {String} tmxFile
- Returns:
- {Element}
-
{Boolean} initWithXML(tmxString, resourcePath)initializes a TMX format with an XML string and a TMX resource path
- Parameters:
- {String} tmxString
- {String} resourcePath
- Returns:
- {Boolean}
-
{Element} parseXMLFile(tmxFile, isXmlString)Initalises parsing of an XML file, either a tmx (Map) file or tsx (Tileset) file
- Parameters:
- {String} tmxFile
- {boolean} isXmlString Optional, Default: false
- Returns:
- {Element}
-
{Boolean} parseXMLString(xmlString)initializes parsing of an XML string, either a tmx (Map) string or tsx (Tileset) string
- Parameters:
- {String} xmlString
- Returns:
- {Boolean}
-
setCurrentString(currentString)
- Parameters:
- {String} currentString
-
setLayerAttribs(value)
- Parameters:
- {Object} value
-
setLayers(value)
- Parameters:
- {cc.TMXLayerInfo} value
-
setMapSize(value)
- Parameters:
- {cc.Size} value
-
setObjectGroups(value)
- Parameters:
- {cc.TMXObjectGroup} value
-
setOrientation(value)
- Parameters:
- {Number} value
-
setParentElement(value)
- Parameters:
- {Object} value
-
setParentGID(value)
- Parameters:
- {Number} value
-
setProperties(value)
- Parameters:
- {object} value
-
setStoringCharacters(value)
- Parameters:
- {Boolean} value
-
setTileProperties(tileProperties)
- Parameters:
- {object} tileProperties
-
setTilesets(value)
- Parameters:
- {cc.TMXTilesetInfo} value
-
setTileSize(value)
- Parameters:
- {cc.Size} value
-
setTMXFileName(fileName)
- Parameters:
- {String} fileName