#include "overlay_ui.hpp" #include "constants.hpp" #include "color.hpp" #include "events.hpp" #include namespace gui { using namespace guecs; using std::string; OverlayUI::OverlayUI() { $gui.position(RAY_VIEW_X, RAY_VIEW_Y, RAY_VIEW_WIDTH, RAY_VIEW_HEIGHT); $gui.layout( "[top_left|top|top_right]" "[*%(300,300)middle|_|_]" "[_|_|_]" "[_|_|_]" "[bottom_left|bottom|bottom_right]" ); } void OverlayUI::init() { $gui.init(); } void OverlayUI::render(sf::RenderWindow& window) { $gui.render(window); } void OverlayUI::show_sprite(string region, string sprite_name) { auto ent = $gui.entity(region); Sprite blood{sprite_name}; auto& cell = $gui.cell_for(ent); blood.init(cell); $gui.set(ent, blood); } void OverlayUI::close_sprite(string region) { auto ent = $gui.entity(region); $gui.remove(ent); } void OverlayUI::show_text(string region, string content) { auto ent = $gui.entity(region); auto &cell = $gui.cell_for(ent); Textual text{content, 20}; text.init(cell, $gui.$font); text.text->setFillColor(ColorValue::LIGHT_MID); $gui.set(ent, text); } void OverlayUI::update_text(string region, string content) { auto ent = $gui.entity(region); if(auto text = $gui.get_if(ent)) { text->text->setString(content); } } void OverlayUI::update_label(string region, string content) { auto ent = $gui.entity(region); if(auto text = $gui.get_if