diff --git a/gui.cpp b/gui.cpp index 130f8fe..b2ab234 100644 --- a/gui.cpp +++ b/gui.cpp @@ -7,7 +7,6 @@ #include #include "systems.hpp" #include "map_view.hpp" -#include // for hflow, paragraph, separator, hbox, vbox, filler, operator|, border, Element #include // for Render #include // for ftxui #include @@ -48,20 +47,19 @@ namespace gui { } void CombatUI::create_render() { - auto player = $level.world->get_the(); - - auto combat_rend = Renderer([&, player]{ - const auto& player_combat = $level.world->get(player.entity); - const auto& combat = $level.world->get(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); } diff --git a/gui.hpp b/gui.hpp index e58fcd5..61e2fc3 100644 --- a/gui.hpp +++ b/gui.hpp @@ -7,6 +7,7 @@ #include "fsm.hpp" #include "render.hpp" #include "map_view.hpp" +#include // for hflow, paragraph, separator, hbox, vbox, filler, operator|, border, Element namespace gui { class StatusUI : public Panel { @@ -27,6 +28,8 @@ namespace gui { class CombatUI : public Panel { public: GameLevel $level; + Component $attack1_button; + Component $attack2_button; CombatUI(GameLevel level) : Panel(RAY_VIEW_X, RAY_VIEW_HEIGHT, 89, 6, false),