pub struct Tileset { /* private fields */ }Expand description
Tiles of one size and palette, in one texture.
Tile indices start at 1, so that 0 means an empty cell in a tilemap. Tiles are numbered in the order written; a terrain’s variants take consecutive indices.
Implementations§
Source§impl Tileset
impl Tileset
pub fn name(&self) -> &str
pub fn tile_width(&self) -> u32
pub fn tile_height(&self) -> u32
pub fn palette(&self) -> &Palette
Sourcepub fn tile_count(&self) -> u32
pub fn tile_count(&self) -> u32
How many tiles there are; indices run from 1 to this.
Sourcepub fn tile(&self, index: u32) -> Option<&Sprite>
pub fn tile(&self, index: u32) -> Option<&Sprite>
The tile at index, from 1. A terrain’s variants are named TERRAIN/VARIANT.
Sourcepub fn index(&self, name: &str) -> Option<u32>
pub fn index(&self, name: &str) -> Option<u32>
The index of the tile named name, such as brick or dirt/5.
pub fn terrains(&self) -> &[Terrain]
pub fn terrain(&self, name: &str) -> Option<&Terrain>
Sourcepub fn tile_rect(&self, index: u32) -> Option<Rect>
pub fn tile_rect(&self, index: u32) -> Option<Rect>
Where tile index is in the texture, in texels.
Sourcepub fn image_size(&self) -> (u32, u32)
pub fn image_size(&self) -> (u32, u32)
The texture’s size in texels: columns tiles wide, as many rows as needed.
Sourcepub fn padded_size(&self, padding: u32) -> (u64, u64)
pub fn padded_size(&self, padding: u32) -> (u64, u64)
The texture’s size with padding pixels around each tile.
Trait Implementations§
impl Eq for Tileset
impl StructuralPartialEq for Tileset
Auto Trait Implementations§
impl Freeze for Tileset
impl RefUnwindSafe for Tileset
impl Send for Tileset
impl Sync for Tileset
impl Unpin for Tileset
impl UnsafeUnpin for Tileset
impl UnwindSafe for Tileset
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
Mutably borrows from an owned value. Read more