Orthogonal, finite map made in Tiled, saved as JSON.
More...
#include <aegis2d/render/tile_map.hpp>
|
| static TileMap | load (const std::filesystem::path &path) |
| | Reads a map and its external tilesets.
|
| |
Orthogonal, finite map made in Tiled, saved as JSON.
Layers keep the order of Tiled, from the bottom one; the layers of a group come in its place, with its offset, opacity and visibility applied. Tile data is the JSON array that Tiled writes by default (Tile Layer Format: CSV); base64, compressed and infinite maps, other orientations and image layers are refused with their reason.
if (!
layer.
tiles.empty()) { ... draw its tiles ... }
}
std::filesystem::path asset_path(const std::filesystem::path &relative)
Path of one asset.
std::vector< std::uint32_t > tiles
For a tile layer, the global id of each cell (flip bits included), row by row from the top-left,...
Definition tile_map.hpp:107
std::vector< MapLayer > layers
Layers, from the bottom one.
Definition tile_map.hpp:141
static TileMap load(const std::filesystem::path &path)
Reads a map and its external tilesets.
const MapLayer * layer(std::string_view name) const noexcept
First layer of a name.
◆ layer()
| const MapLayer * aegis2d::render::TileMap::layer |
( |
std::string_view |
name | ) |
const |
|
noexcept |
First layer of a name.
- Parameters
-
- Returns
- The layer, or nullptr if there is none.
◆ load()
| static TileMap aegis2d::render::TileMap::load |
( |
const std::filesystem::path & |
path | ) |
|
|
static |
Reads a map and its external tilesets.
- Parameters
-
- Returns
- The map.
- Exceptions
-
| TileMapError | if a file cannot be read, is not valid JSON, or the map is broken (missing field, unsupported feature, tile id that no tileset has...). |
◆ tileset()
| const Tileset * aegis2d::render::TileMap::tileset |
( |
std::uint32_t |
gid | ) |
const |
|
noexcept |
Tileset of a tile.
- Parameters
-
| gid | Global tile id, flip bits allowed. |
- Returns
- The tileset that has it, or nullptr for 0 or an id that none has.
◆ height
| int aegis2d::render::TileMap::height = 0 |
◆ layers
| std::vector<MapLayer> aegis2d::render::TileMap::layers {} |
Layers, from the bottom one.
◆ properties
◆ tile_size
◆ tilesets
| std::vector<Tileset> aegis2d::render::TileMap::tilesets {} |
Tilesets, by increasing first_gid.
◆ width
| int aegis2d::render::TileMap::width = 0 |
The documentation for this struct was generated from the following file: