pub struct AttrGrid<'a>(/* private fields */);Available on crate feature
cgb only.Expand description
A rectangle of attribute bytes, with the row stride of the grid it sits in.
A level map is wider than a tilemap, so the strip that scrolls into view is not contiguous in the source. Binding the stride to the data rather than passing it alongside keeps the two from being paired wrongly, and the two kinds of grid are separate types so that one cannot be written where the other belongs.
ⓘ
const LEVEL: AttrGrid = AttrGrid::new(&DATA, 100);
map::write(d, Map::Zero, x, 0, LEVEL.sub(col, 0, 1, 18));Implementations§
Source§impl<'a> AttrGrid<'a>
impl<'a> AttrGrid<'a>
Sourcepub const fn new(data: &'a [u8], width: u8) -> Self
pub const fn new(data: &'a [u8], width: u8) -> Self
All of data, laid out width cells per row.
The height follows from the length, so a partial last row is dropped, and so is anything past row 255.
§Panics
If width is zero.
Trait Implementations§
Auto Trait Implementations§
impl<'a> BankSafe for AttrGrid<'a>
impl<'a> Freeze for AttrGrid<'a>
impl<'a> RefUnwindSafe for AttrGrid<'a>
impl<'a> Send for AttrGrid<'a>
impl<'a> Sync for AttrGrid<'a>
impl<'a> Unpin for AttrGrid<'a>
impl<'a> UnsafeUnpin for AttrGrid<'a>
impl<'a> UnwindSafe for AttrGrid<'a>
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
Mutably borrows from an owned value. Read more