Struct nes_ppu::Sprite

source ·
#[repr(C)]
pub struct Sprite { pub y: u8, pub pattern_index: u8, pub attributes: u8, pub x: u8, }
Expand description

A floating graphic is rendered separately from tiles.

A sprite can be drawn to any position on the screen, and is either 8x8px or 8x16px in size. Each sprite uses one of 4 sprite palettes for color, which are separate from the 4 tile palettes.

Read more about sprites on the NESdev Wiki.

Fields§

§y: u8

Y coordinate of the sprite’s top-left corner.

§pattern_index: u8

The index for the sprite’s graphics. In 8x8px mode, this is relative to the sprite pattern table selected in the PPU ctrl register. In 8x16px mode, The least significant bit sets the bank, and the most significant 7 bits index into pairs of graphics within that bank.

§attributes: u8

A bit field configuring whether the sprite is flipped along the x or y axes, whether it is rendered in front of or behind tiles, and the sprite’s palette index.

§x: u8

X coordinate of the sprite’s top-left corner.

Trait Implementations§

source§

impl Clone for Sprite

source§

fn clone(&self) -> Sprite

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Sprite

source§

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

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

impl Default for Sprite

source§

fn default() -> Sprite

Returns the “default value” for a type. Read more
source§

impl Zeroable for Sprite

source§

fn zeroed() -> Self

source§

impl Copy for Sprite

source§

impl Pod for Sprite

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

impl<T> AnyBitPattern for Twhere T: Pod,

source§

impl<T> NoUninit for Twhere T: Pod,