I can now create any tiles I want. First version is just one room will have a circular pool in it.

This commit is contained in:
Zed A. Shaw 2024-12-24 03:26:06 -05:00
parent 89e31279be
commit 03fe9b3d01
3 changed files with 19 additions and 7 deletions

View file

@ -30,10 +30,7 @@ void TileMap::dump(int show_x, int show_y) {
}
}
void TileMap::load(matrix::Matrix &walls) {
for(matrix::each_cell it{walls}; it.next();) {
string tile_name = walls[it.y][it.x] == SPACE_VALUE ? "FLOOR_TILE" : "WALL_TILE";
void TileMap::set_tile(size_t x, size_t y, string tile_name) {
std::wstring tile_id = $config.wstring(tile_name, "display");
json tile_conf = $config[tile_name];
TileCell tile{
@ -45,8 +42,14 @@ void TileMap::load(matrix::Matrix &walls) {
tile_conf["background"][1],
tile_conf["background"][2]};
$tile_ids[it.y][it.x] = tile_id[0];
$display[it.y][it.x] = tile;
$tile_ids[y][x] = tile_id[0];
$display[y][x] = tile;
}
void TileMap::load(matrix::Matrix &walls) {
for(matrix::each_cell it{walls}; it.next();) {
string tile_name = walls[it.y][it.x] == SPACE_VALUE ? "FLOOR_TILE" : "WALL_TILE";
set_tile(it.x, it.y, tile_name);
}
}