[][src]Crate tiled_json_rs

A handy crate for parsing the Tiled JSON data in to a usable structure.

The crate includes a few small helper functions on Map, TileSet, and TileLayer. These functions are for common tasks such as generating a cloumn/row location (tiles are stored in a 1D array), a located box on an image for helping with tile-to-tilesheet image picking, and loading files (or strings).

Examples

use tiled_json_rs as tiled;
let map = tiled::Map::load_from_file(&PathBuf::from("tests/data/csv.json"))
           .expect("Failed to load map");

Notes:

  • GID starts at 0 for None
  • Local Id starts at 0 for TileSet
  • The tileset must be included in the JSON (this is temporary until parsing the path is done)

Structs

Chunk
Color
Frame
Group

Used to group layers if required

ImageLayer
Layer

A map can contain any number of layers.

Map
Object
ObjectGroup
Terrain
Text
Tile
TileLayer
TileRect

Used to provide the location and dimensions of the required tile on the tiles tileset image

TileSet

A tileset that associates information with each tile.

Vec2

A simple representation of a 2d Vector to pass coords

WangColor
WangSet
WangTile

Enums

DrawOrder
LayerType
ObjectType
Orientation
RenderOrder
StaggerAxis
StaggerIndex
TiledValue

A TiledValue is similar to JSON values. It contains the basic types that Tiled uses. This is generally used in the properties of layers, tiles, and objects.