Add gauge and frame.

This commit is contained in:
Arthur Sonzogni
2018-09-22 09:49:43 +02:00
parent e577d67f2a
commit dd92b89611
9 changed files with 141 additions and 40 deletions

View File

@@ -1,30 +1,22 @@
#include <chrono>
#include <iostream>
#include <thread>
#include "ftxui/core/screen.hpp"
#include "ftxui/core/dom/elements.hpp"
#include <iostream>
int main(int argc, const char *argv[])
{
using namespace ftxui::dom;
auto document =
hbox(
flex(vbox(
gauge(0.1),
gauge(0.2),
gauge(0.3)
)),
flex(vbox(
gauge(0.1),
gauge(0.8),
gauge(0.3)
))
);
//auto screen = ftxui::Screen::WholeTerminal();
auto screen = ftxui::Screen::TerminalOutput(document);
Render(screen, document.get());
for(float percentage = 0; percentage <= 1.0; percentage+=0.001) {
using namespace ftxui::dom;
auto document =
hbox(text(L"gauge = -"), flex(gauge(percentage)), text(L"-"));
auto screen = ftxui::Screen(100, 1);
Render(screen, document.get());
std::cout << '\r' << screen.ToString() << std::flush;
std::cout << screen.ToString();
getchar();
return 0;
using namespace std::chrono_literals;
std::this_thread::sleep_for(0.01s);
}
std::cout << std::endl;
}