|
|
|
@ -7,7 +7,6 @@ |
|
|
|
|
#include <numbers> |
|
|
|
|
#include "systems.hpp" |
|
|
|
|
#include "map_view.hpp" |
|
|
|
|
#include <ftxui/dom/elements.hpp> // for hflow, paragraph, separator, hbox, vbox, filler, operator|, border, Element |
|
|
|
|
#include <ftxui/dom/node.hpp> // for Render |
|
|
|
|
#include <ftxui/screen/box.hpp> // for ftxui |
|
|
|
|
#include <ftxui/component/loop.hpp> |
|
|
|
@ -48,20 +47,19 @@ namespace gui { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CombatUI::create_render() { |
|
|
|
|
auto player = $level.world->get_the<Player>(); |
|
|
|
|
|
|
|
|
|
auto combat_rend = Renderer([&, player]{ |
|
|
|
|
const auto& player_combat = $level.world->get<Combat>(player.entity); |
|
|
|
|
const auto& combat = $level.world->get<Combat>(player.entity); |
|
|
|
|
$attack1_button = Button("ATTACK1", []{ fmt::println("ATTACK1 clicked"); }); |
|
|
|
|
$attack2_button = Button("ATTACK2", []{ fmt::println("ATTACK2 clicked"); }); |
|
|
|
|
|
|
|
|
|
auto combat_rend = Renderer([&]{ |
|
|
|
|
return hbox({ |
|
|
|
|
text(fmt::format("HP: {: >3} DMG: {: >3}", |
|
|
|
|
player_combat.hp, |
|
|
|
|
combat.damage)) | flex_grow |
|
|
|
|
$attack1_button->Render(), |
|
|
|
|
$attack2_button->Render() |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
set_renderer(combat_rend); |
|
|
|
|
add($attack1_button); |
|
|
|
|
add($attack2_button); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|