[−][src]Struct rs_tiled_json::map::Map
The primary structure of all modules.
Fields
orientation: MapOrientation
height: u16
width: u16
nextobjectid: u32
nextlayerid: u16
tileheight: u16
tilewidth: u16
tiledversion: String
backgroundcolor: Option<Color>
renderorder: RenderOrder
hexsidelength: u16
staggeraxis: Option<StaggerAxis>
staggerindex: Option<StaggerIndex>
tilesets: Vec<Tileset>
layers: Vec<Layer>
properties: Vec<Property>
Methods
impl Map
[src]
pub fn layers(&self) -> &Vec<Layer>
[src]
Borrow the layers vector.
This is useful for loading arbitrary game data; you will just iterate through each layer and utilize the appropriate data.
Most would be more interested in get_layer_by_name().
pub fn layer_by_name(&self, name: &str) -> Option<&Layer>
[src]
Use this to grab a layer by name.
This is particularly useful when you know what kinds of data you need to pick up.
Maps might have three static layers describing the scenery; I might name them LAYER_GROUND, LAYER_FLOOR, LAYER_SKY. I could load the map and the tilesets, grab those tile layers, and get to building my internal representation.
pub fn tilesets(&self) -> &Vec<Tileset>
[src]
Borrow the tileset vector.
This is the best way to ensure you have loaded all of the necessary textures into memory and are able to decompose gids into their local id variants.
pub fn tileset_by_gid(&self, gid: u32) -> Option<&Tileset>
[src]
Looks for the tileset with the GID provided, automatically stripping any flags present on the GID (flipping horizontally, vertically, etc...)
Do note that no bounds checking is done. If you search for gid: 12352234 and you have one tileset with 1000 tiles, you will still receive that one tileset back. Just be sure the value you send as gid came directly from the map file, tile layer data.
This only returns Option::None when no tilesets exist in the map.
pub fn width(&self) -> u16
[src]
Get the map width in tiles.
pub fn height(&self) -> u16
[src]
Get the map height in tiles.
pub fn tile_width(&self) -> u16
[src]
Get the width of a tile in the map.
pub fn tile_height(&self) -> u16
[src]
Get the height of a tile in the map.
pub fn bg_color(&self) -> Option<Color>
[src]
Get the background color of the map if specified.
pub fn orientation(&self) -> MapOrientation
[src]
Retrieve orientation as variant of MapOrientation.
Can be converted to a string using the method to_string().
pub fn render_order(&self) -> RenderOrder
[src]
Retrieve renderorder as variant of RenderOrder. This applies only to Orthogonal Maps but you'll get the default value anyway.
Can be converted to a string using the method to_string().
pub fn hex_side_length(&self) -> u16
[src]
Get the hex side length. Hex maps only.
pub fn stagger_axis(&self) -> Option<StaggerAxis>
[src]
Get the stagger axis as a variant of StaggerAxis. Useful only to staggered/hexagonal maps, but will still yeild a valid default if you call it irelevantly.
Can be converted to a string using the method to_string()
pub fn stagger_index(&self) -> Option<StaggerIndex>
[src]
Get the stagger index as a variant of StaggerIndex. Useful only to staggered/hexagonal maps, but will still yeild a valid default if you call it irelevantly.
Can be converted to a string using the method to_string()
pub fn tiled_version(&self) -> &String
[src]
Get the version of tiled the map was compiled with.
Trait Implementations
impl Debug for Map
[src]
impl<'de> Deserialize<'de> for Map
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl HasProperty for Map
[src]
fn get_property_vector(&self) -> &Vec<Property>
[src]
Provide access to property values for Maps
fn get_property(&self, name: &str) -> Option<&Property>
[src]
fn get_property_value(&self, name: &str) -> Option<&PropertyValue>
[src]
Auto Trait Implementations
impl RefUnwindSafe for Map
impl Send for Map
impl Sync for Map
impl Unpin for Map
impl UnwindSafe for Map
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,