Working on tileset-metadata editing.

This commit is contained in:
2025-06-16 22:58:42 -05:00
parent b8bed66928
commit 214f27fa21
5 changed files with 161 additions and 76 deletions

View File

@@ -252,6 +252,8 @@ public:
void DrawLevel(const Level* level) const;
bool IsMouseGridCellInBounds();
void Draw();
// TODO: Closing the app nominally doesn't work on Linux.

View File

@@ -25,6 +25,7 @@ struct Tile
std::string name;
Quad quad;
json::value metadata;
bool collides;
};
/// TODO: Only generate tile entry for tiles that are used in the level, or have been assigned custom metadata.
@@ -131,4 +132,18 @@ protected:
/// Fill the tile-id lookup table with their respective partial-sprite bounding boxes.
void ComputeQuads();
void FillTiles() {
// Generate some tiles
tiles.reserve(rows*cols);
for (int i = 0 ; i < this->rows*this->cols; i++)
{
Tile tile;
tile.id = i;
tile.quad = quads[i];
tile.name = std::format("tile_{}", i);
tile.metadata = json::value();
tiles.emplace(tiles.begin() + i, tile);
}
}
};