LEL is working at a basic grid level, able to render boxes where I want.
This commit is contained in:
parent
846b7aaf16
commit
872cedc8e1
8 changed files with 127 additions and 99 deletions
|
@ -4,11 +4,31 @@
|
|||
|
||||
namespace gui {
|
||||
CombatUI::CombatUI(GameLevel level) :
|
||||
$layout(RAY_VIEW_X, RAY_VIEW_HEIGHT,
|
||||
RAY_VIEW_WIDTH, SCREEN_HEIGHT - RAY_VIEW_HEIGHT),
|
||||
$level(level)
|
||||
{
|
||||
bool good = $layout.parse(
|
||||
"[attack1 | attack2 | attack3 | heal]"
|
||||
"[move1 | move2 | move3 | move4]"
|
||||
);
|
||||
|
||||
dbc::check(good, "failed to parse combat layout");
|
||||
|
||||
for(auto& [name, cell] : $layout.cells) {
|
||||
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({uint8_t(cell.col * 75), 100, 100});
|
||||
button.setOutlineColor({200, 200, 200});
|
||||
button.setOutlineThickness(5);
|
||||
$shapes[name] = button;
|
||||
}
|
||||
}
|
||||
|
||||
void CombatUI::draw(sf::RenderWindow& window) {
|
||||
(void)window;
|
||||
for(auto& [name, shape] : $shapes) {
|
||||
window.draw(shape);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue