# TMX [![Build Status](https://api.travis-ci.org/adtennant/rust-tmx.svg?branch=master)](https://travis-ci.org/adtennant/rust-tmx) [![Crates.io](https://img.shields.io/crates/v/tmx.svg)](https://crates.io/crates/tmx) [![Docs](https://docs.rs/tmx/badge.svg)](https://docs.rs/tmx) [![License](https://img.shields.io/crates/l/tmx.svg)](https://github.com/adtennant/rust-tmx/blob/master/LICENSE) TMX is a library for loading [Tiled](https://mapeditor.org) (XML and JSON) maps in Rust. ## Usage ```bash cargo add tmx ``` ## Examples ### Loading a Map ```rust use tmx::Map; fn main() -> Result<(), Box> { let map = r##" 1,2684354561,1,2147483649, 1610612737,3221225473,1073741825,3221225473, 2147483649,3758096385,1073741825,536870913, 536870913,1073741825,3758096385,2147483649 "##; let map = Map::from_xml(map)?; println!("{:?}", map); Ok(()) } ``` ### Loading a Tileset ```rust use tmx::Tileset; fn main() -> Result<(), Box> { let tileset = r##" "##; let tileset = Tileset::from_xml(tileset)?; println!("{:?}", tileset); Ok(()) } ``` See the [docs](https://docs.rs/tmx) for more information. ## TMX Map Format Support | Element | Support | | ------------------ | ---------- | | `` | ✅ Full | | `` | 🛑 None | | - `` | 🛑 None | | - `` | 🛑 None | | `` | ⚠️ Partial | | - `` | 🛑 None | | - `` | 🛑 None | | - `` | ✅ Full | | - `` | 🛑 None | | - - `` | 🛑 None | | - `` | ✅ Full | | - - `` | ✅ Full | | - `` | 🛑 None | | - - `` | 🛑 None | | `` | ✅ Full | | - `` | ✅ Full | | - `` | ✅ Full | | - `` | ✅ Full | | `` | 🛑 None | | - `` | 🛑 None | | - `` | 🛑 None | | - `` | 🛑 None | | - `` | 🛑 None | | - `` | 🛑 None | | - `` | 🛑 None | | `` | 🛑 None | | `` | 🛑 None | | `` | 🛑 None | | - `` | 🛑 None | ## Features The following features are available and enabled by default. | Feature | Description | | ------------- | ----------------------------------------------------------------------------------- | | `xml` | Allows loading XML maps. | | `base64-data` | Allows loading maps where the Tile Layer Format is `Base64 (uncompressed)`. | | `gzip-data` | Allows loading maps where the Tile Layer Format is `Base64 (gzip compressed)`. | | `zlib-data` | Allows loading maps where the Tile Layer Format is `Base64 (zlib compressed)`. | | `zstd-data` | Allows loading maps where the Tile Layer Format is `Base64 (Zstandard compressed)`. | ## License [MIT](https://github.com/adtennant/rust-tmx/blob/master/LICENSE)