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
886 B
33 lines
886 B
#include "combat_ui.hpp"
|
|
#include "constants.hpp"
|
|
#include "color.hpp"
|
|
|
|
namespace gui {
|
|
CombatUI::CombatUI(GameLevel level) :
|
|
$level(level)
|
|
{
|
|
$gui.position(RAY_VIEW_X, RAY_VIEW_HEIGHT, RAY_VIEW_WIDTH, SCREEN_HEIGHT - RAY_VIEW_HEIGHT);
|
|
$gui.layout(
|
|
"[*%(100,150)button_attack1 | *%(100,150)button_attack2 | *%(100,150)button_attack3 | *%(100,150)button_heal]"
|
|
"[ >.%(100,50)label_hp | *%.(200,50)bar_hp | _ ]");
|
|
render();
|
|
}
|
|
|
|
void CombatUI::render() {
|
|
auto& world = $gui.world();
|
|
|
|
for(auto& [name, cell] : $gui.cells()) {
|
|
auto button = $gui.entity(name);
|
|
world.set<lel::Cell>(button, cell);
|
|
world.set<Rectangle>(button, {});
|
|
world.set<Clickable>(button, {100});
|
|
world.set<Textual>(button, {name});
|
|
}
|
|
|
|
$gui.init();
|
|
}
|
|
|
|
void CombatUI::draw(sf::RenderWindow& window) {
|
|
$gui.render(window);
|
|
}
|
|
}
|
|
|