#[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.
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§
impl Copy for Sprite
impl Pod for Sprite
Auto Trait Implementations§
impl RefUnwindSafe for Sprite
impl Send for Sprite
impl Sync for Sprite
impl Unpin for Sprite
impl UnwindSafe for Sprite
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
source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,
§type Bits = T
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
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.