#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) { (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.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, 0, 0}); inner.setOutlineThickness(5); inner.setFillColor({50, 50, 50}); $shapes.push_back(inner); } } void CombatUI::draw(sf::RenderWindow& window) { for(auto& shape : $shapes) { window.draw(shape); } } }