rmp::Tilemap
A level read from an LDtk or a Tiled file: its tile layers, which cells are solid, and the objects placed in it. Every Scene has one in map, which rmp::assets::load_map() fills; it moves and does not copy.
Tilemap
Declared here and defined in tilemap.cpp, all of them: MapData is incomplete in this header, and even a defaulted constructor written here would instantiate the unique_ptr's deleter against it.
valid, operator bool
Whether a map is loaded: false for an empty one, and for one whose file was missing or did not parse. Every query below then answers zero, empty or false, and on_object() registers nothing.
bounds
In world units
tile_size
One cell, in world units
layer_count
How many tile layers; 0 is the bottom one
object_count
How many MapObjects it holds
The levels of an LDtk world
level, neighbour_at
The level this map is, and the OTHER level of its world at a point — "" while the point is still in this one, or in none. So walking into the next level is
const std::string_view next = map.neighbour_at(player.position);
if (!next.empty()) rmp::Scene::change<Level>(std::string(next), player.position);and the new scene loads that level and puts the player back where it was: the coordinates are the world's, so they still mean the same place. Tiled maps and LDtk's linear layouts have no world, and always say "". Views of the parsed map, each followed by a NUL: valid while it is loaded.
Object layers -> objects in the scene
on_object, spawn_objects
A type with no factory registered comes out as a plain rmp::Object with the position, the size and a collider — and solid already set WHEN THE EDITOR GAVE IT AN AREA, which is the right default for a wall or a platform drawn in the editor. A point, and anything else whose width or height is zero, is a marker rather than a shape and comes out non-solid: an invisible collider at a spawn point is not what anybody drew.
Registering the same class twice REPLACES, because two factories for one class is never what anybody means.
Queries, for whatever you want to do yourself
tile_at
The tile in one cell of one layer, as its global tile id: 0 when the cell is empty, outside the layer, or there is no map. Layers count from 0 in the order the file has them, and the cell is in that layer's own grid. For LDtk it is the topmost tile of the cell.
solid_at
Whether a solid cell is under a point, in world units, on any layer: an LDtk IntGrid cell painted with solid, any tile of a Tiled layer whose class is solid, or a tile its tileset marks solid. False with no map.
solid_in
Whether a solid cell covers any of the rectangle. Only touching it is not: a box standing on the floor is not in the floor.
draw
Drawn by the scene, underneath everything. Here because a game that wants the map somewhere else in its own order can call it. The scene draws only what its camera shows — draw(area), with area the world rectangle in view — so a level a hundred screens long costs what one screen costs; draw() is every tile.