Figured out that I don't need a special screen, just send events to the component directly with OnEvent. However, you have to component->Add() or call Render(component, []) with it or else it's not considered a child.

This commit is contained in:
Zed A. Shaw 2024-11-14 12:37:31 -05:00
parent e3cff8142c
commit 96ee16e598
9 changed files with 32 additions and 1078 deletions

View file

@ -7,6 +7,9 @@
#include <ftxui/component/component.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/dom/canvas.hpp>
#include "ftxui/component/component.hpp" // for Button, operator|=, Renderer, Vertical, Modal
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive, Component
#include "ftxui/dom/elements.hpp" // for operator|, separator, text, size, Element, vbox, border, GREATER_THAN, WIDTH, center, HEIGHT
#include <locale>
#include <string>
#include "map.hpp"
@ -17,7 +20,7 @@
#include "panel.hpp"
using std::string;
using ftxui::Canvas, ftxui::Component, ftxui::Screen;
using ftxui::Canvas, ftxui::Component, ftxui::Screen, ftxui::Button;
constexpr int SCREEN_X = 40;
constexpr int SCREEN_Y = 30;
@ -41,6 +44,7 @@ class GUI {
Panel $status_ui;
Panel $map_view;
Point $view_port;
Component $test_button;
DinkyECS::World& $world;
SoundManager $sounds;
SFMLRender $renderer;