Working on tileset-metadata editing.
This commit is contained in:
@@ -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.
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user