MapData

Top-level Tiled structure - encapsulates all data in the map file.

Members

Enums

Orientation
enum Orientation

Map orientation.

RenderOrder
enum RenderOrder

The order in which tiles on tile layers are rendered. From the docs: Valid values are right-down (the default), right-up, left-down and left-up. In all cases, the map is drawn row-by-row. (since 0.10, but only supported for orthogonal maps at the moment)

Functions

getLayer
auto getLayer(string name)

Fetch a map layer by its name. No check for layers with duplicate names is performed. Throws if no layer has a matching name (case-sensitive).

getTileset
auto getTileset(string name)

Fetch a tileset by its name. No check for layers with duplicate names is performed. Throws if no tileset has a matching name (case-sensitive).

getTileset
auto getTileset(TiledGid gid)

Fetch the tileset containing the tile a given GID. Throws if the gid is out of range for all tilesets

save
void save(string path)

Save a Tiled map to a JSON file.

Static functions

load
auto load(string path)

Load a Tiled map from a JSON file. Throws if no file is found at that path or if the parsing fails.

Variables

backgroundColor
string backgroundColor;

Hex-formatted background color (#RRGGBB)

layers
LayerData[] layers;

All map layers (tiles and objects)

nextObjectId
int nextObjectId;

Global counter across all objects

numCols
int numCols;

Number of tile columns

numRows
int numRows;

Number of tile rows

orientation
Orientation orientation;

Orthogonal, isometric, or staggered

properties
string[string] properties;

Key-value property pairs on map

renderOrder
string renderOrder;

Rendering direction (orthogonal only)

tileHeight
int tileHeight;

General grid size. Individual tiles sizes may differ.

tileWidth
int tileWidth;

General grid size. Individual tiles sizes may differ.

tilesets
TilesetData[] tilesets;

All tile sets defined in this map

Meta