Skip to main content

Module map

Module map 

Source
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§

AttrAccesscgb
Proof that the attribute plane is the grid mapped at the tilemap addresses.
AttrGridcgb
A rectangle of attribute bytes, with the row stride of the grid it sits in.
TileGrid
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_attrscgb
Map the attribute plane and leave it mapped for f.
fill
Put tile in every cell of a w by h rectangle.
set
Put tile in one cell.
write
Copy src in with its top left at (x, y).