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 std::path::PathBuf;
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)