pub struct Tilemap<Image>{ /* private fields */ }
Implementations§
Source§impl<Image> Tilemap<Image>
impl<Image> Tilemap<Image>
Sourcepub fn px_for_tile<P>(&self, tile: P) -> (isize, isize)where
P: Into<MapPosition>,
pub fn px_for_tile<P>(&self, tile: P) -> (isize, isize)where
P: Into<MapPosition>,
Pixel coord for tile Result may be offscreen, before or after
Sourcepub fn orig_px_for_tile<P>(&self, tile: P) -> (isize, isize)where
P: Into<MapPosition>,
pub fn orig_px_for_tile<P>(&self, tile: P) -> (isize, isize)where
P: Into<MapPosition>,
Pixel coord for tile, ignoring subtile offset Result may be offscreen, before or after
Sourcepub fn first_visible_tile(&self) -> MapPosition
pub fn first_visible_tile(&self) -> MapPosition
Returns the pos of the first tile with at least one pixel visible
Will match Tilemap::first_visible_tile unless a subtile offset is set
Sourcepub fn first_fully_visible_tile(&self) -> MapPosition
pub fn first_fully_visible_tile(&self) -> MapPosition
Returns the pos of the first fully visible tile
Sourcepub fn last_visible_tile(&self) -> MapPosition
pub fn last_visible_tile(&self) -> MapPosition
Returns the pos of the last tile with at least one pixel visible
Will match Tilemap::last_visible_tile unless a subtile offset is set
Sourcepub fn last_fully_visible_tile(&self) -> MapPosition
pub fn last_fully_visible_tile(&self) -> MapPosition
Returns the pos of the last fully visible tile
Sourcepub fn is_inside<P>(&self, tile: P) -> boolwhere
P: Into<MapPosition>,
pub fn is_inside<P>(&self, tile: P) -> boolwhere
P: Into<MapPosition>,
Returns true if tile
is inside the map
Sourcepub fn draw<F>(&self, render: F)
pub fn draw<F>(&self, render: F)
Loops through all visible tiles
calling render
with the image and px coord
pub fn update_pos_with_offset(&self, pos: (isize, isize)) -> (isize, isize)
Sourcepub fn center_on<P>(&mut self, pos: P)where
P: Into<MapPosition>,
pub fn center_on<P>(&mut self, pos: P)where
P: Into<MapPosition>,
Moves center of visible map to pos
Sourcepub fn all_tiles_with_flag(&self, flag: u32) -> Vec<MapPosition>
pub fn all_tiles_with_flag(&self, flag: u32) -> Vec<MapPosition>
Returns a list of tiles matching flag
Sourcepub fn tile_has_flag<P>(&self, tile: P, value: u32) -> boolwhere
P: Into<MapPosition>,
pub fn tile_has_flag<P>(&self, tile: P, value: u32) -> boolwhere
P: Into<MapPosition>,
Returns true if tile
has a flag of value
Sourcepub fn flags_for_tile<P>(&self, tile: P) -> u32where
P: Into<MapPosition>,
pub fn flags_for_tile<P>(&self, tile: P) -> u32where
P: Into<MapPosition>,
Returns flag value for tile
Sourcepub fn set_flag<P>(&mut self, tile: P, value: u32)where
P: Into<MapPosition>,
pub fn set_flag<P>(&mut self, tile: P, value: u32)where
P: Into<MapPosition>,
Sets the flag value for tile
Sourcepub fn clear_flag<P>(&mut self, tile: P, value: u32)where
P: Into<MapPosition>,
pub fn clear_flag<P>(&mut self, tile: P, value: u32)where
P: Into<MapPosition>,
Removes specified flags for tile
Sourcepub fn default_start(&self) -> MapPosition
pub fn default_start(&self) -> MapPosition
The default, safe start position on the map
pub fn tile_size(&self) -> (u32, u32)
pub fn size(&self) -> MapSize
Sourcepub fn set_subtile_offset(&mut self, subtile_offset: (i16, i16))
pub fn set_subtile_offset(&mut self, subtile_offset: (i16, i16))
Sets a pixel offset for drawing Primarily designed for smoothing animation the map when a character or camera is moving
Sourcepub fn subtile_offset(&self) -> (i16, i16)
pub fn subtile_offset(&self) -> (i16, i16)
Returns a pixel offset for drawing