[−][src]Struct quicksilver::geom::Tilemap
A grid of Tile values
Methods
impl<T: Clone> Tilemap<T>
[src]
pub fn new(
map_size: impl Into<Vector>,
tile_size: impl Into<Vector>
) -> Tilemap<T>
[src]
map_size: impl Into<Vector>,
tile_size: impl Into<Vector>
) -> Tilemap<T>
Create a map full of empty, non-solid tiles of a given size
pub fn with_data(
data: Vec<Tile<T>>,
map_size: impl Into<Vector>,
tile_size: impl Into<Vector>
) -> Tilemap<T>
[src]
data: Vec<Tile<T>>,
map_size: impl Into<Vector>,
tile_size: impl Into<Vector>
) -> Tilemap<T>
Create a map with pre-filled data
pub fn width(&self) -> f32
[src]
Get the width of the map
pub fn height(&self) -> f32
[src]
Get the height of the map
pub fn size(&self) -> Vector
[src]
Get the size of the map
pub fn region(&self) -> Rectangle
[src]
Get the region the map takes up
pub fn tile_width(&self) -> f32
[src]
Get the width of an individual tile
pub fn tile_height(&self) -> f32
[src]
Get the height of an individual tile
pub fn tile_size(&self) -> Vector
[src]
Get the size of a tile
pub fn valid(
&self,
index: impl Into<Vector>
) -> bool
[src]
&self,
index: impl Into<Vector>
) -> bool
Check if a point is within the map bounds
pub fn shape_valid(
&self,
shape: impl Shape
) -> bool
[src]
&self,
shape: impl Shape
) -> bool
Checks if a shape is valid in its entirety
pub fn get(
&self,
index: impl Into<Vector>
) -> Option<&Tile<T>>
[src]
&self,
index: impl Into<Vector>
) -> Option<&Tile<T>>
Get the tile found at a given point, if it is valid
pub fn get_mut(
&mut self,
index: impl Into<Vector>
) -> Option<&mut Tile<T>>
[src]
&mut self,
index: impl Into<Vector>
) -> Option<&mut Tile<T>>
Get a mutable reference to a tile at a given point, if it is valid
pub fn set(
&mut self,
index: impl Into<Vector>,
value: Tile<T>
)
[src]
&mut self,
index: impl Into<Vector>,
value: Tile<T>
)
Set the value at a given point
pub fn point_empty(
&self,
index: impl Into<Vector>
) -> bool
[src]
&self,
index: impl Into<Vector>
) -> bool
Find if a point's tile is empty
pub fn shape_empty(
&self,
shape: &impl Shape
) -> bool
[src]
&self,
shape: &impl Shape
) -> bool
Finds if the area taken by a shape is empty
pub fn align_left(&self, x: f32) -> f32
[src]
Align a given X value to the leftmost edge of a tile
pub fn align_right(&self, x: f32) -> f32
[src]
Align a given X value to the rightmost edge of a tile
pub fn align_top(&self, y: f32) -> f32
[src]
Align a given Y value to the topmost edge of a tile
pub fn align_bottom(&self, y: f32) -> f32
[src]
Align a given Y value to the bottommost edge of a tile
#[must_use]
pub fn move_until_contact<U: Shape>(
&self,
bounds: U,
speed: impl Into<Vector>
) -> (U, Vector)
[src]
&self,
bounds: U,
speed: impl Into<Vector>
) -> (U, Vector)
Find the furthest a shape can move along a vector, and what its future speed should be
pub fn convert<U, F>(&self, conversion: F) -> Tilemap<U> where
U: Clone,
F: Fn(&T) -> U,
[src]
U: Clone,
F: Fn(&T) -> U,
Convert a Tilemap into a map of a different type
Trait Implementations
impl<T: Clone + Clone> Clone for Tilemap<T>
[src]
fn clone(&self) -> Tilemap<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Debug + Clone> Debug for Tilemap<T>
[src]
impl<T: Clone> Serialize for Tilemap<T> where
T: Serialize,
[src]
T: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de, T: Clone> Deserialize<'de> for Tilemap<T> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<T> Erased for T
impl<T> Same for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
[src]
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
[src]
fn is_in_subset(&self) -> bool
[src]
unsafe fn to_subset_unchecked(&self) -> SS
[src]
fn from_subset(element: &SS) -> SP
[src]
impl<T> Downcast for T where
T: Any,
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,