Beginning state machine for controlling the boss fight UI is up.

This commit is contained in:
Zed A. Shaw 2025-12-07 00:21:07 -05:00
parent 1537a81aac
commit 9739441a9c
8 changed files with 173 additions and 135 deletions

View file

@ -5,6 +5,8 @@
#include "animation.hpp"
#include <fmt/xchar.h>
#include "game_level.hpp"
#include "gui/guecstra.hpp"
#include "gui/fsm_events.hpp"
namespace boss {
using namespace guecs;
@ -28,16 +30,25 @@ namespace boss {
$actions.position(0,0, SCREEN_WIDTH-BOSS_VIEW_WIDTH, SCREEN_HEIGHT);
$actions.layout(
"[*(200,400)combat|_]"
"[_|_]"
"[_|_]"
"[_|_]"
"[*(200,300)stats]"
"[*%(100,400)combat]"
"[_]"
"[_]"
"[_]"
"[commit]"
"[*%(100,300)stats]"
"[_]"
"[_]");
auto commit = $actions.entity("commit");
$actions.set<Rectangle>(commit, {});
$actions.set<Text>(commit, {L"COMMIT"});
$actions.set<Effect>(commit, {});
$actions.set<Clickable>(commit,
guecs::make_action(commit, Events::GUI::COMBAT_START, {}));
auto stats = $actions.entity("stats");
$actions.set<Rectangle>(stats, {});
update_stats();
$actions.init();
@ -60,8 +71,6 @@ namespace boss {
if($world->has_event<Events::GUI>()) {
auto [evt, entity, data] = $world->recv<Events::GUI>();
auto result = std::any_cast<Events::Combat>(data);
auto& player_is = $arena.$actors.at($arena.$actor_name_ids.at("player"));
auto& boss_is = $arena.$actors.at($arena.$actor_name_ids.at("boss"));
if(result.player_did > 0) {
status += L"\nYOU HIT!";
@ -74,16 +83,6 @@ namespace boss {
} else {
status += L"\nBOSS MISSED!";
}
/*
if(result.player_did > 0) {
zoom("boss14", 1.8);
} else if(result.enemy_did > 0) {
zoom(player_is.cell, 2.0);
} else {
zoom("", 0.0);
}
*/
}
$actions.show_text("stats", status);