Panel now holds data on how it should be rendered and render just uses that instead of calculating it.
This commit is contained in:
parent
1a3bbaedda
commit
f79e7638c0
5 changed files with 27 additions and 17 deletions
16
panel.hpp
16
panel.hpp
|
@ -6,9 +6,12 @@
|
|||
#include <ftxui/dom/canvas.hpp>
|
||||
#include <ftxui/screen/screen.hpp>
|
||||
#include <ftxui/dom/canvas.hpp>
|
||||
#include <SFML/Graphics/Color.hpp>
|
||||
#include <locale>
|
||||
#include <codecvt>
|
||||
|
||||
const int UI_PANEL_BORDER_PX=5;
|
||||
|
||||
using ftxui::Renderer, ftxui::Component, ftxui::Element, ftxui::Screen;
|
||||
|
||||
struct Panel {
|
||||
|
@ -16,20 +19,25 @@ struct Panel {
|
|||
int y;
|
||||
int width;
|
||||
int height;
|
||||
std::wstring $screenout;
|
||||
bool has_border = false;
|
||||
bool must_clear = true;
|
||||
sf::Color default_bg = sf::Color(0,0,0);
|
||||
sf::Color border_color = sf::Color::Red;
|
||||
int border_px = UI_PANEL_BORDER_PX;
|
||||
|
||||
bool $dirty = true;
|
||||
Component $component;
|
||||
Screen $screen;
|
||||
bool $must_clear = true;
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> $converter;
|
||||
std::wstring $screenout;
|
||||
|
||||
Panel(int width, int height, int x, int y, bool must_clear=true) :
|
||||
x(x),
|
||||
y(y),
|
||||
width(width),
|
||||
height(height),
|
||||
$screen(Screen(width, height)),
|
||||
$must_clear(must_clear)
|
||||
must_clear(must_clear),
|
||||
$screen(Screen(width, height))
|
||||
{
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue