Struct simple_tilemap::Tile
source · pub struct Tile<U = ()> {
pub id: TileId,
pub color: Color,
pub opts: BlitOptions,
pub data: U,
}
Expand description
Tile in a Tilemap
.
Fields§
§id: TileId
Id of the tile.
color: Color
Color of the tile. Will be multiplied by the tile’s ‘original’ color (the one in the tileset).
opts: BlitOptions
Blit options.
data: U
Custom user data.
Implementations§
source§impl<U> Tile<U>
impl<U> Tile<U>
sourcepub fn with_color(self, color: Color) -> Self
pub fn with_color(self, color: Color) -> Self
Set tile color.
Allows for chaining tile creation like Tile::new(4).with_color(Color::new(255, 0, 255, 255)).solid()
etc.
sourcepub fn set_color(&mut self, color: Color) -> &mut Self
pub fn set_color(&mut self, color: Color) -> &mut Self
Set tile color.
Allows for chaining tile modifying like tilemap.get_mut_tile(1, 1).unwrap().set_color(Color::new(255, 0, 255, 255))
etc.
sourcepub fn with_user_data(self, data: U) -> Self
pub fn with_user_data(self, data: U) -> Self
Set tile user data.
Allows for chaining tile creation like Tile::new(4).with_color(Color::new(255, 0, 255, 255))
etc.
sourcepub fn set_user_data(&mut self, data: U) -> &mut Self
pub fn set_user_data(&mut self, data: U) -> &mut Self
Set tile user data.
Allows for chaining tile modifying like tilemap.get_mut_tile(1, 1).unwrap().set_color(Color::new(255, 0, 255, 255))
etc.
sourcepub fn with_blit_options(self, opts: BlitOptions) -> Self
pub fn with_blit_options(self, opts: BlitOptions) -> Self
Specify the blit options.
Allows for chaining tile creation like Tile::new(4).with_color(Color::new(255, 0, 255, 255))
etc.
sourcepub fn set_blit_options(&mut self, opts: BlitOptions) -> &mut Self
pub fn set_blit_options(&mut self, opts: BlitOptions) -> &mut Self
Set the tile’s blit options.
Allows for chaining tile modifying like tilemap.get_mut_tile(1, 1).unwrap().set_color(Color::new(255, 0, 255, 255))
etc.