Can now do UI rendering based on the name and also have gaps in the grid reliably.

This commit is contained in:
Zed A. Shaw 2025-02-16 12:34:48 -05:00
parent 79c84ce885
commit 3ec2bf4784
4 changed files with 39 additions and 26 deletions

13
lel.cpp
View file

@ -17,12 +17,13 @@ namespace lel {
}
void Parser::id(std::string name) {
dbc::check(!cells.contains(name),
fmt::format("duplicate cell name {}", name));
cells.insert_or_assign(name, cur);
if(name != "_") {
dbc::check(!cells.contains(name),
fmt::format("duplicate cell name {}", name));
cells.insert_or_assign(name, cur);
}
cur = {cur.col + 1, cur.row};
auto& row = grid.back();
row.push_back(name);
}
@ -32,8 +33,10 @@ namespace lel {
int cell_height = grid_h / rows;
for(auto& row : grid) {
size_t columns = row.size();
for(auto& name : row) {
size_t columns = row.size();
if(name == "_") continue;
auto& cell = cells.at(name);
int cell_width = grid_w / columns;