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
Trait Implementations§
Auto Trait Implementations§
impl<Image> Freeze for Tilemap<Image>
impl<Image> RefUnwindSafe for Tilemap<Image>where
Image: RefUnwindSafe,
impl<Image> !Send for Tilemap<Image>
impl<Image> !Sync for Tilemap<Image>
impl<Image> Unpin for Tilemap<Image>
impl<Image> UnwindSafe for Tilemap<Image>where
Image: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.