Can now use lel::center to center something inside a cell.
This commit is contained in:
parent
c03a384372
commit
aa149b6574
4 changed files with 32 additions and 5 deletions
|
@ -15,18 +15,27 @@ namespace gui {
|
|||
dbc::check(good, "failed to parse combat layout");
|
||||
|
||||
for(auto& [name, cell] : $layout.cells) {
|
||||
(void)name;
|
||||
sf::RectangleShape button;
|
||||
button.setPosition({float(cell.x + 10), float(cell.y + 10)});
|
||||
button.setSize({float(cell.w - 20), float(cell.h - 20)});
|
||||
button.setFillColor({100, 100, 100});
|
||||
button.setOutlineColor({200, 200, 200});
|
||||
button.setOutlineThickness(5);
|
||||
$shapes[name] = button;
|
||||
$shapes.push_back(button);
|
||||
|
||||
sf::RectangleShape inner;
|
||||
auto inner_cell = lel::center(30, 40, cell);
|
||||
inner.setPosition({float(inner_cell.x), float(inner_cell.y)});
|
||||
inner.setSize({float(inner_cell.w), float(inner_cell.h)});
|
||||
inner.setOutlineColor({100, 100, 100});
|
||||
inner.setOutlineThickness(5);
|
||||
$shapes.push_back(inner);
|
||||
}
|
||||
}
|
||||
|
||||
void CombatUI::draw(sf::RenderWindow& window) {
|
||||
for(auto& [name, shape] : $shapes) {
|
||||
for(auto& shape : $shapes) {
|
||||
window.draw(shape);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue