Struct simple_tilemap::Tile
source · pub struct Tile {
pub id: TileId,
pub color: Color,
pub solid: bool,
pub opaque: bool,
pub opts: BlitOptions,
}Expand description
Tile in a Tilemap.
Fields§
§id: TileIdId of the tile.
color: ColorColor of the tile. Will be multiplied by the tile’s ‘original’ color (the one in the tileset).
solid: boolWhether the tile is solid or not. This isn’t used in any way by this library, but can be generally useful.
opaque: boolWhether the tile is opaque or not. This isn’t used in any way by this library, but can be generally useful.
opts: BlitOptionsBlit options.
Implementations§
source§impl Tile
impl Tile
sourcepub const fn with_color(self, color: Color) -> Self
pub const fn with_color(self, color: Color) -> Self
Specify 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 the tile’s color.
Allows for chaining tile modifying like tilemap.get_mut_tile(1, 1).unwrap().set_color(Color::new(255, 0, 255, 255)).set_solid(false) etc.
sourcepub const fn solid(self) -> Self
pub const fn solid(self) -> Self
Specify that the tile is solid.
Allows for chaining tile creation like Tile::new(4).with_color(Color::new(255, 0, 255, 255)).solid() etc.
sourcepub fn set_solid(&mut self, solid: bool) -> &mut Self
pub fn set_solid(&mut self, solid: bool) -> &mut Self
Set the tile’s solidness.
Allows for chaining tile modifying like tilemap.get_mut_tile(1, 1).unwrap().set_color(Color::new(255, 0, 255, 255)).set_solid(false) etc.
sourcepub const fn opaque(self) -> Self
pub const fn opaque(self) -> Self
Specify that the tile is opaque.
Allows for chaining tile creation like Tile::new(4).with_color(Color::new(255, 0, 255, 255)).solid() etc.
sourcepub fn set_opaque(&mut self, opaque: bool) -> &mut Self
pub fn set_opaque(&mut self, opaque: bool) -> &mut Self
Set the tile’s opacity.
Allows for chaining tile modifying like tilemap.get_mut_tile(1, 1).unwrap().set_color(Color::new(255, 0, 255, 255)).set_solid(false) etc.
sourcepub const fn with_blit_options(self, opts: BlitOptions) -> Self
pub const 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)).solid() 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)).set_solid(false) etc.