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

@ -6,7 +6,6 @@
#include <ftxui/dom/canvas.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/dom/canvas.hpp>
#include "sfml_screen.hpp" // for SFMLScreen
#include <locale>
#include <codecvt>
@ -20,7 +19,7 @@ struct Panel {
std::wstring $screenout;
bool $dirty = true;
Component $component;
SFMLScreen $screen;
Screen $screen;
bool $must_clear = true;
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> $converter;
@ -29,12 +28,14 @@ struct Panel {
y(y),
width(width),
height(height),
$screen(SFMLScreen::FixedSize(width, height)),
$screen(Screen(width, height)),
$must_clear(must_clear)
{};
{
};
void resize(int width, int height);
void set_renderer(std::function< Element()> render);
void set_renderer(Component renderer);
void add(Component child);
void render();
const std::wstring &to_string();
const Screen &screen();