pub struct BgAttr(/* private fields */);cgb only.Expand description
Per-cell tilemap attributes, in VRAM bank 1 at the tilemap addresses.
| Bit | Field | Access | Meaning |
|---|---|---|---|
| 7 | priority | R/W | Set draws this cell’s color indices 1-3 over objects. |
| 6 | y_flip | R/W | Mirror vertically. |
| 5 | x_flip | R/W | Mirror horizontally. |
| 4 | — | R/W | Ignored by the hardware. |
| 3 | bank | R/W | Fetch this cell’s tile from VRAM bank 1. |
| 2-0 | palette | R/W | Which of the eight background palettes. |
Implementations§
Source§impl BgAttr
impl BgAttr
Sourcepub const fn with_palette_checked(self, value: u8) -> Result<Self, ()>
pub const fn with_palette_checked(self, value: u8) -> Result<Self, ()>
Which of the eight background palettes.
Bits: 0..3
Sourcepub const fn with_palette(self, value: u8) -> Self
pub const fn with_palette(self, value: u8) -> Self
Which of the eight background palettes.
Bits: 0..3
Sourcepub const fn set_palette(&mut self, value: u8)
pub const fn set_palette(&mut self, value: u8)
Which of the eight background palettes.
Bits: 0..3
Sourcepub const fn set_palette_checked(&mut self, value: u8) -> Result<(), ()>
pub const fn set_palette_checked(&mut self, value: u8) -> Result<(), ()>
Which of the eight background palettes.
Bits: 0..3
Sourcepub const fn bank(&self) -> bool
pub const fn bank(&self) -> bool
Fetch this cell’s tile from VRAM bank 1 rather than bank 0.
Bits: 3..4
Sourcepub const fn with_bank_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_bank_checked(self, value: bool) -> Result<Self, ()>
Fetch this cell’s tile from VRAM bank 1 rather than bank 0.
Bits: 3..4
Sourcepub const fn with_bank(self, value: bool) -> Self
pub const fn with_bank(self, value: bool) -> Self
Fetch this cell’s tile from VRAM bank 1 rather than bank 0.
Bits: 3..4
Sourcepub const fn set_bank(&mut self, value: bool)
pub const fn set_bank(&mut self, value: bool)
Fetch this cell’s tile from VRAM bank 1 rather than bank 0.
Bits: 3..4
Sourcepub const fn set_bank_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_bank_checked(&mut self, value: bool) -> Result<(), ()>
Fetch this cell’s tile from VRAM bank 1 rather than bank 0.
Bits: 3..4
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
Draw this cell’s color indices 1-3 over objects.
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, ()>
Draw this cell’s color indices 1-3 over objects.
Bits: 7..8
Sourcepub const fn with_priority(self, value: bool) -> Self
pub const fn with_priority(self, value: bool) -> Self
Draw this cell’s color indices 1-3 over objects.
Bits: 7..8
Sourcepub const fn set_priority(&mut self, value: bool)
pub const fn set_priority(&mut self, value: bool)
Draw this cell’s color indices 1-3 over objects.
Bits: 7..8