Struct rust_rpg_toolkit::map::Map [−][src]
pub struct Map {
pub background_color: Color,
pub world_offset: Vec2,
pub grid_size: UVec2,
pub tile_size: Vec2,
pub layers: HashMap<String, MapLayer>,
pub tilesets: HashMap<String, MapTileset>,
pub draw_order: Vec<String>,
pub properties: HashMap<String, MapProperty>,
pub player_spawn_point: Option<Vec2>,
}
Fields
background_color: Color
world_offset: Vec2
grid_size: UVec2
tile_size: Vec2
layers: HashMap<String, MapLayer>
tilesets: HashMap<String, MapTileset>
draw_order: Vec<String>
properties: HashMap<String, MapProperty>
player_spawn_point: Option<Vec2>
Implementations
pub fn get_tiles(
&self,
layer_id: &str,
rect: Option<URect>
) -> MapTileIterator<'_>ⓘNotable traits for MapTileIterator<'a>impl<'a> Iterator for MapTileIterator<'a> type Item = (u32, u32, &'a Option<MapTile>);
impl<'a> Iterator for MapTileIterator<'a> type Item = (u32, u32, &'a Option<MapTile>);
pub fn get_collisions(&self, collider: Collider) -> Vec<(Vec2, CollisionKind)>ⓘ
Trait Implementations
Retrieve the map’s dimensions. Made optional to reduce API breakage.
fn point2d_to_index(&self, pt: Point) -> usize
fn point2d_to_index(&self, pt: Point) -> usize
Convert a Point (x/y) to an array index. Defaults to an index based on an array strided X first. Read more
fn index_to_point2d(&self, idx: usize) -> Point
fn index_to_point2d(&self, idx: usize) -> Point
Convert an array index to a point. Defaults to an index based on an array strided X first. Read more
True is you cannot see through the tile, false otherwise. Default implementation always returns true, and is provided so you don’t have to implement it if you aren’t using it. Read more
Return a vector of tile indices to which one can path from the idx. These do NOT have to be contiguous - if you want to support teleport pads, that’s awesome. Default implementation is provided that proves an empty list, in case you aren’t using it. Read more
Return the distance you would like to use for path-finding. Generally, Pythagoras distance (implemented in geometry) is fine, but you might use Manhattan or any other heuristic that fits your problem. Default implementation returns 1.0, which isn’t what you want but prevents you from having to implement it when not using it. Read more
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Map
impl UnwindSafe for Map
Blanket Implementations
Mutably borrows from an owned value. Read more