21 std::vector<int> operator()(
int width,
int height)
const {
22 std::vector<int> output(width);
23 for (
int i = 0; i < width; ++i) {
25 v += 0.1f * sin((i + shift) * 0.1f);
26 v += 0.2f * sin((i + shift + 10) * 0.15f);
27 v += 0.1f * sin((i + shift) * 0.03f);
30 output[i] =
static_cast<int>(v);
37std::vector<int>
triangle(
int width,
int height) {
38 std::vector<int> output(width);
39 for (
int i = 0; i < width; ++i) {
40 output[i] = i % (height - 4) + 2;
46 using namespace ftxui;
47 using namespace std::chrono_literals;
51 std::string reset_position;
52 for (
int i = 0;; ++i) {
54 auto document = hbox({
56 graph(std::ref(my_graph)),
62 graph(std::ref(my_graph)) |
color(Color::BlueLight),
64 graph(std::ref(my_graph)) |
color(Color::RedLight),
66 graph(std::ref(my_graph)) |
color(Color::YellowLight),
72 const int min_width = 40;
73 document |= size(HEIGHT, GREATER_THAN, min_width);
75 auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
77 std::cout << reset_position;
79 reset_position =
screen.ResetPosition();
81 const auto sleep_time = 0.03s;
82 std::this_thread::sleep_for(sleep_time);
std::vector< int > triangle(int width, int height)
Element color(const LinearGradient &gradient, Element child)
Définit la couleur de premier plan d'un élément avec un effet de dégradé linéaire.
void Render(Screen &screen, const Element &element)
Affiche un élément sur un ftxui::Screen.
L'espace de noms FTXUI ftxui::