Expand description
Tilemaps: two 32 by 32 grids of tile indices.
One byte per cell, naming a tile the way tile describes.
Which grid a layer reads is set on the layer, by bg::set_map
and window::set_map; the two layers can share one. See https://gbdev.io/pandocs/Tile_Maps.html.
§Wrapping
The grid is 32 cells square where the screen shows 20 by 18, and it wraps on both axes: cell 31 is followed by cell 0. Scrolling relies on that, so coordinates here are taken modulo 32 rather than checked. There is no out-of-range cell on a torus.
Structs§
- Attr
Access cgb - Proof that the attribute plane is the grid mapped at the tilemap addresses.
- Attr
Grid cgb - A rectangle of attribute bytes, with the row stride of the grid it sits in.
- Tile
Grid - A rectangle of tile indices, with the row stride of the grid it sits in.
Enums§
- Map
- Which of the two tilemaps.
Constants§
- SIDE
- Cells along one side of a tilemap.
Functions§
- edit_
attrs cgb - Map the attribute plane and leave it mapped for
f. - fill
- Put
tilein every cell of awbyhrectangle. - set
- Put
tilein one cell. - write
- Copy
srcin with its top left at(x, y).