Skip to main content

Tile

Struct Tile 

Source
pub struct Tile {
    pub index: u16,
    pub frames: u16,
    pub frame_ms: u16,
    pub flip: Flip,
}
Expand description

What a cell shows: a tile of its layer’s tile set, or the frames of an animation, which the shader picks from RenderFrame::time with no work on the CPU.

Fields§

§index: u16

The tile, or the first frame. An index past the tile set’s last tile wraps around to the first.

§frames: u16

How many frames: tiles index, index + 1 and so on, each shown in turn, then again from the first. 0 and 1 are a still tile.

§frame_ms: u16

How long each frame shows, in milliseconds. 0 counts as 1. Every tile of the same frame length changes frame at the same moment.

§flip: Flip

Which way the tile is mirrored, in place.

Implementations§

Source§

impl Tile

Source

pub const fn new(index: u16) -> Self

Tile index, still and unmirrored.

Source

pub const fn animated(index: u16, frames: u16, frame_ms: u16) -> Self

frames tiles from index, each shown for frame_ms milliseconds in turn.

Trait Implementations§

Source§

impl Clone for Tile

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Tile

Source§

impl Debug for Tile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Tile

Source§

impl PartialEq for Tile

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Tile

Auto Trait Implementations§

§

impl Forget for Tile

§

impl Freeze for Tile

§

impl Move for Tile

§

impl RefUnwindSafe for Tile

§

impl Send for Tile

§

impl Sync for Tile

§

impl Unpin for Tile

§

impl UnsafeUnpin for Tile

§

impl UnwindSafe for Tile

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.