The next little game in the series where I make a fancy rogue game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
roguish/panel.hpp

50 lines
1.2 KiB

#pragma once
#include <ftxui/dom/node.hpp> // for Render
#include <ftxui/component/component.hpp>
#include <ftxui/dom/canvas.hpp>
#include <ftxui/screen/screen.hpp>
#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 {
int x;
int y;
int width;
int height;
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;
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),
must_clear(must_clear),
$screen(Screen(width, height))
{
};
void resize(int width, int height);
void set_renderer(Component renderer);
void add(Component child);
void render();
const std::wstring &to_string();
const Screen &screen();
};