You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
910 B
33 lines
910 B
#include "combat_ui.hpp"
|
|
#include "constants.hpp"
|
|
#include "color.hpp"
|
|
|
|
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]"
|
|
);
|
|
|
|
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({100, 100, 100});
|
|
button.setOutlineColor({200, 200, 200});
|
|
button.setOutlineThickness(5);
|
|
$shapes[name] = button;
|
|
}
|
|
}
|
|
|
|
void CombatUI::draw(sf::RenderWindow& window) {
|
|
for(auto& [name, shape] : $shapes) {
|
|
window.draw(shape);
|
|
}
|
|
}
|
|
}
|
|
|