pub struct TileSet {
pub texture: Handle<Texture>,
pub columns: u16,
pub rows: u16,
}Expand description
A tile atlas: a texture cut into columns × rows equal tiles,
numbered row by row from the top left.
In pixel-perfect mode a tile shows each texel as a whole number of pixels when the texture’s width and height are whole multiples of the columns and rows, and the layer’s tile size times the zoom is a whole multiple of a tile’s texels, as for sprites (ADR-0018).
Fields§
§texture: Handle<Texture>The texture.
columns: u16The tiles across. 0 counts as 1.
rows: u16The tiles down. 0 counts as 1.
Implementations§
Source§impl TileSet
impl TileSet
Sourcepub fn block_uv(&self, index: u16, size: UVec2) -> Rect
pub fn block_uv(&self, index: u16, size: UVec2) -> Rect
The region of the texture, normalized, of the block of size tiles
whose top-left tile is index: of that one tile for a size of
(1, 1). A tall tile is drawn as a sprite of such a block.
An index past the last tile wraps around to the first, as in a layer. A block that does not fit reaches past the texture’s edge.
Trait Implementations§
impl Copy for TileSet
impl Eq for TileSet
impl StructuralPartialEq for TileSet
Auto Trait Implementations§
impl Forget for TileSet
impl Freeze for TileSet
impl Move 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