Separate out the major UIs to get ready for their development, and enable debug button.

This commit is contained in:
Zed A. Shaw 2025-02-13 10:55:45 -05:00
parent 7eec67ffc8
commit 9b3b81683a
11 changed files with 154 additions and 116 deletions

35
combat_ui.cpp Normal file
View file

@ -0,0 +1,35 @@
#include "combat_ui.hpp"
#include <ftxui/dom/node.hpp> // for Render
#include <ftxui/screen/box.hpp> // for ftxui
#include <ftxui/component/loop.hpp>
#include <ftxui/screen/color.hpp>
#include <ftxui/dom/table.hpp>
#include "constants.hpp"
#include "color.hpp"
namespace gui {
using namespace ftxui;
CombatUI::CombatUI(GameLevel level) :
Panel(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT, false),
$level(level)
{
default_bg = {0,0,0};
}
void CombatUI::create_render() {
$attack1_button = Button("ATTACK1", []{ fmt::println("ATTACK1 clicked"); });
$attack2_button = Button("ATTACK2", []{ fmt::println("ATTACK2 clicked"); });
auto combat_rend = Renderer([&]{
return hbox({
$attack1_button->Render(),
$attack2_button->Render()
});
});
set_renderer(combat_rend);
add($attack1_button);
add($attack2_button);
}
}