All of the UIs should be cleared out, and that just leaves the tests.

This commit is contained in:
Zed A. Shaw 2025-08-19 23:58:42 -04:00
parent d5ff57e025
commit 564f9842a2
23 changed files with 126 additions and 145 deletions

View file

@ -4,12 +4,12 @@
#include <fmt/xchar.h>
#include "gui/guecstra.hpp"
#include "inventory.hpp"
#include "game_level.hpp"
namespace gui {
using namespace guecs;
CombatUI::CombatUI(GameLevel level) :
$level(level)
CombatUI::CombatUI()
{
$gui.position(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT);
$gui.layout(
@ -31,15 +31,16 @@ namespace gui {
$gui.set<Sound>(button, {sound});
$gui.set<Effect>(button, {.duration=0.5f, .name=effect_name});
$gui.set<Clickable>(button,
guecs::make_action($level, button, event, {action}));
guecs::make_action(button, event, {action}));
return button;
}
void CombatUI::init() {
auto world = Game::current_world();
using guecs::THEME;
$gui.set<Background>($gui.MAIN, {$gui.$parser, THEME.DARK_MID});
auto& the_belt = $level.world->get_the<ritual::Belt>();
auto& the_belt = world->get_the<ritual::Belt>();
for(int slot = 0; slot < the_belt.max_slots; slot++) {
if(the_belt.has(slot)) {
@ -67,7 +68,7 @@ namespace gui {
auto hp_gauge = $gui.entity("hp_gauge");
$gui.set<Sprite>(hp_gauge, {"stone_doll_cursed"});
$gui.set<Clickable>(hp_gauge,
guecs::make_action($level, hp_gauge, Events::GUI::HP_STATUS, {}));
guecs::make_action(hp_gauge, Events::GUI::HP_STATUS, {}));
$gui.init();
}
@ -76,8 +77,7 @@ namespace gui {
$gui.render(window);
}
void CombatUI::update_level(GameLevel &level) {
$level = level;
void CombatUI::update_level() {
init();
}