After some prototyping I have what I think I want for the map. Just a simple piece of paper you take out that has the ASCII map on it.

This commit is contained in:
Zed A. Shaw 2025-03-21 02:51:02 -04:00
parent acbf384e2a
commit 6c9016eb0f
21 changed files with 1184 additions and 92 deletions

View file

@ -1,6 +1,7 @@
#include "tilemap.hpp"
#include "dbc.hpp"
#include "constants.hpp"
#include <iostream>
using nlohmann::json;
using components::Tile;
@ -14,18 +15,26 @@ TileMap::TileMap(size_t width, size_t height) :
{
}
void TileMap::dump(int show_x, int show_y) {
std::string TileMap::to_string(int show_x, int show_y) {
std::string result;
for(matrix::each_row it{$tile_ids}; it.next();) {
const Tile &cell = $display[it.y][it.x];
if(int(it.x) == show_x && int(it.y) == show_y) {
fmt::print("{}<", cell.display);
result += "@";
} else {
fmt::print("{} ", cell.display);
result += cell.display;
}
if(it.row) fmt::print("\n");
if(it.row) result += "\n";
}
return result;
}
void TileMap::dump(int show_x, int show_y) {
std::cout << to_string(show_x, show_y) << std::endl;
}
void TileMap::set_tile(size_t x, size_t y, string tile_name) {