pub struct OamAttr(/* private fields */);Expand description
Sprite attribute byte (OamEntry::attr).
| Bit | Field | Access | Meaning |
|---|---|---|---|
| 7 | priority | R/W | Set draws the sprite behind BG colors 1-3. |
| 6 | y_flip | R/W | Mirror vertically. |
| 5 | x_flip | R/W | Mirror horizontally. |
| 4 | dmg_palette | R/W | DMG palette: clear = OBP0, set = OBP1. |
| 3 | cgb_bank | R/W | CGB tile VRAM bank. |
| 2-0 | cgb_palette | R/W | CGB object palette (0-7). |
Implementations§
Source§impl OamAttr
impl OamAttr
Sourcepub const fn cgb_palette(&self) -> u8
pub const fn cgb_palette(&self) -> u8
CGB object palette (0-7).
Bits: 0..3
Sourcepub const fn with_cgb_palette_checked(self, value: u8) -> Result<Self, ()>
pub const fn with_cgb_palette_checked(self, value: u8) -> Result<Self, ()>
CGB object palette (0-7).
Bits: 0..3
Sourcepub const fn with_cgb_palette(self, value: u8) -> Self
pub const fn with_cgb_palette(self, value: u8) -> Self
CGB object palette (0-7).
Bits: 0..3
Sourcepub const fn set_cgb_palette(&mut self, value: u8)
pub const fn set_cgb_palette(&mut self, value: u8)
CGB object palette (0-7).
Bits: 0..3
Sourcepub const fn set_cgb_palette_checked(&mut self, value: u8) -> Result<(), ()>
pub const fn set_cgb_palette_checked(&mut self, value: u8) -> Result<(), ()>
CGB object palette (0-7).
Bits: 0..3
Sourcepub const fn with_cgb_bank_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_cgb_bank_checked(self, value: bool) -> Result<Self, ()>
CGB tile VRAM bank.
Bits: 3..4
Sourcepub const fn with_cgb_bank(self, value: bool) -> Self
pub const fn with_cgb_bank(self, value: bool) -> Self
CGB tile VRAM bank.
Bits: 3..4
Sourcepub const fn set_cgb_bank(&mut self, value: bool)
pub const fn set_cgb_bank(&mut self, value: bool)
CGB tile VRAM bank.
Bits: 3..4
Sourcepub const fn set_cgb_bank_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_cgb_bank_checked(&mut self, value: bool) -> Result<(), ()>
CGB tile VRAM bank.
Bits: 3..4
Sourcepub const fn dmg_palette(&self) -> bool
pub const fn dmg_palette(&self) -> bool
DMG palette: false = OBP0, true = OBP1.
Bits: 4..5
Sourcepub const fn with_dmg_palette_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_dmg_palette_checked(self, value: bool) -> Result<Self, ()>
DMG palette: false = OBP0, true = OBP1.
Bits: 4..5
Sourcepub const fn with_dmg_palette(self, value: bool) -> Self
pub const fn with_dmg_palette(self, value: bool) -> Self
DMG palette: false = OBP0, true = OBP1.
Bits: 4..5
Sourcepub const fn set_dmg_palette(&mut self, value: bool)
pub const fn set_dmg_palette(&mut self, value: bool)
DMG palette: false = OBP0, true = OBP1.
Bits: 4..5
Sourcepub const fn set_dmg_palette_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_dmg_palette_checked(&mut self, value: bool) -> Result<(), ()>
DMG palette: false = OBP0, true = OBP1.
Bits: 4..5
Sourcepub const fn with_x_flip_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_x_flip_checked(self, value: bool) -> Result<Self, ()>
Mirror horizontally.
Bits: 5..6
Sourcepub const fn with_x_flip(self, value: bool) -> Self
pub const fn with_x_flip(self, value: bool) -> Self
Mirror horizontally.
Bits: 5..6
Sourcepub const fn set_x_flip(&mut self, value: bool)
pub const fn set_x_flip(&mut self, value: bool)
Mirror horizontally.
Bits: 5..6
Sourcepub const fn set_x_flip_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_x_flip_checked(&mut self, value: bool) -> Result<(), ()>
Mirror horizontally.
Bits: 5..6
Sourcepub const fn with_y_flip_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_y_flip_checked(self, value: bool) -> Result<Self, ()>
Mirror vertically.
Bits: 6..7
Sourcepub const fn with_y_flip(self, value: bool) -> Self
pub const fn with_y_flip(self, value: bool) -> Self
Mirror vertically.
Bits: 6..7
Sourcepub const fn set_y_flip(&mut self, value: bool)
pub const fn set_y_flip(&mut self, value: bool)
Mirror vertically.
Bits: 6..7
Sourcepub const fn set_y_flip_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_y_flip_checked(&mut self, value: bool) -> Result<(), ()>
Mirror vertically.
Bits: 6..7
Sourcepub const fn priority(&self) -> bool
pub const fn priority(&self) -> bool
Priority: true draws the sprite behind BG colors 1-3.
Bits: 7..8
Sourcepub const fn with_priority_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_priority_checked(self, value: bool) -> Result<Self, ()>
Priority: true draws the sprite behind BG colors 1-3.
Bits: 7..8
Sourcepub const fn with_priority(self, value: bool) -> Self
pub const fn with_priority(self, value: bool) -> Self
Priority: true draws the sprite behind BG colors 1-3.
Bits: 7..8
Sourcepub const fn set_priority(&mut self, value: bool)
pub const fn set_priority(&mut self, value: bool)
Priority: true draws the sprite behind BG colors 1-3.
Bits: 7..8