#include "arena_ui.hpp" #include "easings.hpp" #include "sound.hpp" #include namespace arena { using namespace guecs; ArenaUI::ArenaUI(shared_ptr world, DinkyECS::Entity entity_id) : $world(world), $entity_id(entity_id), $config(world->get_the()) { $status.position(0, 0, BOSS_VIEW_X, SCREEN_HEIGHT); $status.layout( "[main_status]" "[(150)status_3|(150)status_4]" "[(150)status_5|(150)status_6]" "[(150)status_7|(150)status_8]"); $overlay.position(BOSS_VIEW_X, BOSS_VIEW_Y, BOSS_VIEW_WIDTH, BOSS_VIEW_HEIGHT); $overlay.layout("[_|=(256,256)enemy|_]"); $sounds = $world->get($entity_id); $combat = $world->get($entity_id); $sprite_config = $world->get($entity_id); } void ArenaUI::configure_sprite() { $animation = $world->get($entity_id); $animation.frame_width = $sprite_config.width; auto enemy_id = $overlay.entity("enemy"); auto& enemy_image = $overlay.get(enemy_id); sf::IntRect frame_rect{{0,0},{$sprite_config.width, $sprite_config.height}}; enemy_image.sprite->setTextureRect(frame_rect); } void ArenaUI::configure_background() { if($world->has($entity_id)) { auto& boss = $world->get($entity_id); $entity_background = textures::get(boss.background); $entity_background.sprite->setPosition({BOSS_VIEW_X, BOSS_VIEW_Y}); $status.world().set_the({$status.$parser}); $entity_has_stage = true; if(boss.stage) { $entity_stage = textures::get(*boss.stage); } else { $entity_stage = textures::get("devils_fingers_background"); } $entity_stage.sprite->setPosition({BOSS_VIEW_X, BOSS_VIEW_Y}); } else { $entity_has_stage = false; $entity_background = textures::get("devils_fingers_background"); $entity_background.sprite->setPosition({BOSS_VIEW_X, BOSS_VIEW_Y}); $status.world().set_the({$status.$parser}); } } void ArenaUI::configure_gui() { for(auto& [name, cell] : $status.cells()) { auto button = $status.entity(name); $status.set(button, {}); $status.set(button, { [this, name](auto, auto){ dbc::log(fmt::format("STATUS: {}", name)); } }); if(name == "main_status") { $status.set(button, {fmt::format(L"HP: {}", $combat.hp)}); } else { $status.set