roomGrid.module
README.md
roomGrid
The room map: rooms declared with Nav.addRoom (rectangles of grid cells joined by doors) drawn once the viewer has visited them. The room the viewer stands in is lit and their position pulses in it, each door is a gap in its room's outline, a door the viewer has not tried yet carries a pulsing arrow, and a room's icons (home, skull, star, check...) sit in its middle. It suits metroidvanias, dungeon crawlers and any game whose map is a set of rooms rather than a picture of the ground.
Called by navUiKit.minimap for the roomGrid minimap (centred on the viewer, with the room's name and the share of rooms seen in a header strip) and by navUiKit.mapScreen for the roomGrid map screen (every visited room fitted, with names and a legend). Colours come from the theme's roomFill, roomHere, roomEdge, roomNew and roomText, falling back to its map colours.
RoomGrid.draw(cmds, ctx, x, y, w, h, { cell, cx, cy, showAll, names }) draws into any box, clipped to it, so a world can put the room map in a screen of its own. RoomGrid.fit(rooms, w, h, maxCell), RoomGrid.shown(core, key, showAll), RoomGrid.viewerCell(core, wx, wy, wz), RoomGrid.legend(core, key, th) and RoomGrid.swatch(...) are the parts it is made of.