diff --git a/README.md b/README.md index 5ad18c52fa5fa0f1d28dd17f8e28fa9c833ba940..956a7b0647657fc809b6d925e824ad5686bf0ec7 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,29 @@ Read maps from the [Tiled Map Editor](http://www.mapeditor.org/) into rust for use in video games. It is game engine agnostic and pretty barebones at the moment. Documentation is available [on rust-ci](http://rust-ci.org/mattyhall/rs-tiled/doc/tiled/). +### Example + +```rust +extern crate serialize; +extern crate xml; +extern crate tiled; + +use std::io::File; +use std::io::BufferedReader; +use xml::reader::EventReader; +use tiled::parse; + +fn main() { + let file = File::open(&Path::new("assets/tiled_base64_zlib.tmx")).unwrap(); + println!("Opened file"); + let reader = BufferedReader::new(file); + let mut parser = EventReader::new(reader); + let map = parse(&mut parser).unwrap(); + println!("{}", map); + println!("{}", map.get_tileset_by_gid(22)); +} +``` + ### Things missing There are a few things missing at the moment: @@ -15,6 +38,7 @@ There are a few things missing at the moment: * Image layers * A nice API. At the moment you can access attributes and properties, find tilesets by GID and loop through the tiles. This leaves a user of the library with a bit to do. +### Licences assets/tilesheet.png by Buch (http://blog-buch.rhcloud.com/) Licenced under MIT