19#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
22 " ",
" ",
" ",
" ",
"▌",
"▌",
"▌",
"█",
"█",
"█",
24 " ",
" ",
"▏",
"▎",
"▍",
"▌",
"▋",
"▊",
"▉",
"█",
46class Gauge :
public Node {
49 : progress_(
progress), direction_(direction) {
51 if (!(progress_ > 0.F)) {
54 if (!(progress_ < 1.F)) {
59 void ComputeRequirement()
override {
63 requirement_.flex_grow_x = 1;
64 requirement_.flex_grow_y = 0;
65 requirement_.flex_shrink_x = 1;
66 requirement_.flex_shrink_y = 0;
70 requirement_.flex_grow_x = 0;
71 requirement_.flex_grow_y = 1;
72 requirement_.flex_shrink_x = 0;
73 requirement_.flex_shrink_y = 1;
76 requirement_.min_x = 1;
77 requirement_.min_y = 1;
98 const int y = box_.y_min;
115 while (x <= box_.x_max) {
121 for (
int x = box_.x_min; x <= box_.x_max; x++) {
122 screen.PixelAt(x, y).inverted ^=
true;
128 const int x = box_.x_min;
129 if (x > box_.x_max) {
145 while (y <= box_.y_max) {
151 for (
int y = box_.y_min; y <= box_.y_max; y++) {
152 screen.PixelAt(x, y).inverted ^=
true;
170 return std::make_shared<Gauge>(
progress, direction);
Element gaugeDirection(float progress, Direction direction)
Draw a high definition progress bar progressing in specified direction.
std::shared_ptr< Node > Element
std::shared_ptr< T > Make(Args &&... args)
Element gaugeRight(float progress)
Draw a high definition progress bar progressing from left to right.
Element gaugeUp(float progress)
Draw a high definition progress bar progressing from bottom to top.
Element gaugeLeft(float progress)
Draw a high definition progress bar progressing from right to left.
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.
Element gauge(float progress)
Draw a high definition progress bar.
Element gaugeDown(float progress)
Draw a high definition progress bar progressing from top to bottom.