ftxui::Screen
#include <ftxui/screen/screen.hpp>Derived classes: ftxui::ScreenInteractive
A rectangular grid of Pixel.
Examples: dom/border, dom/border_style, dom/canvas, dom/color_gallery, dom/color_info_palette256, dom/color_truecolor_HSV, dom/color_truecolor_RGB, dom/dbox, dom/gauge, dom/graph, dom/gridbox, dom/hflow (+18 more)
Summary
| Symbol | Description |
|---|---|
stencil | |
Screen | |
at | Access a character a given position. |
PixelAt | Access a Pixel at a given position. |
ToString | Produce a std::string that can be used to print the Screen on the terminal. Don't forget to flush stdout. Alternatively, you can use Screen::Print(); |
Print | |
dimx | |
dimy | |
ResetPosition | Return a string to be printed in order to reset the cursor position to the beginning of the screen. |
Clear | Clear all the pixel from the screen. |
ApplyShader | |
cursor | |
SetCursor | |
Create | Create a screen with the given dimension. |
Public Attributes
stencil
Box stencil;Public Member Functions
Screen
Screen(int dimx, int dimy);Examples: dom/border, dom/border_style, dom/canvas, dom/color_gallery, dom/color_info_palette256, dom/color_truecolor_HSV, dom/color_truecolor_RGB, dom/dbox, dom/gauge, dom/graph, dom/gridbox, dom/hflow (+18 more)
at
std::string & at(int x, int y);Access a character a given position.
Parameters:
x: The character position along the x-axis.y: The character position along the y-axis.
PixelAt
Access a Pixel at a given position.
Parameters:
x: The pixel position along the x-axis.y: The pixel position along the y-axis.
ToString
std::string ToString();Produce a std::string that can be used to print the Screen on the terminal. Don't forget to flush stdout. Alternatively, you can use Screen::Print();
Print
void Print();dimx
int dimx() const;dimy
int dimy() const;ResetPosition
std::string ResetPosition(bool clear = false);Return a string to be printed in order to reset the cursor position to the beginning of the screen.
std::string reset_position;
while(true) {
auto document = render();
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
Render(screen, document);
std::cout << reset_position << screen.ToString() << std::flush;
reset_position = screen.ResetPosition();
using namespace std::chrono_literals;
std::this_thread::sleep_for(0.01s);
}Returns: The string to print in order to reset the cursor position to the beginning.
Clear
void Clear();Clear all the pixel from the screen.
ApplyShader
void ApplyShader();cursor
Cursor cursor() const;SetCursor
void SetCursor(Cursor cursor);Static Functions
Create
static Screen Create(Dimensions dimension);Create a screen with the given dimension.
Create
static Screen Create(Dimensions width, Dimensions height);Create a screen with the given dimension along the x-axis and y-axis.