FTXUI 6.1.9
C++ functional terminal UI.
Chargement...
Recherche...
Aucune correspondance
examples/dom/spinner.cpp
Aller à la documentation de ce fichier.
1// Copyright 2020 Arthur Sonzogni. Tous droits réservés.
2// L'utilisation de ce code source est régie par la licence MIT que l'on peut trouver dans
3// le fichier LICENSE.
4#include <chrono> // pour operator""s, chrono_literals
5#include <ftxui/dom/elements.hpp> // pour Element, operator|, separator, filler, hbox, size, spinner, text, vbox, bold, border, Fit, EQUAL, WIDTH
6#include <ftxui/screen/screen.hpp> // pour Full, Screen
7#include <iostream> // pour cout, endl, ostream
8#include <string> // pour to_string, operator<<, string
9#include <thread> // pour sleep_for
10#include <utility> // pour move
11#include <vector> // pour vector
12
13#include "ftxui/dom/node.hpp" // pour Render
14#include "ftxui/screen/color.hpp" // pour ftxui
15
16int main() {
17 using namespace ftxui;
18 using namespace std::chrono_literals;
19
20 std::string reset_position;
21 for (int index = 0; index < 200; ++index) {
22 std::vector<Element> entries;
23 for (int i = 0; i < 23; ++i) {
24 if (i != 0) {
25 entries.push_back(separator());
26 }
27 entries.push_back( //
28 hbox({
29 text(std::to_string(i)) | size(WIDTH, EQUAL, 2),
30 separator(),
31 spinner(i, index) | bold,
32 }));
33 }
34 auto document = hbox({
35 vbox(std::move(entries)) | border,
36 filler(),
37 });
38 auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
39 Render(screen, document);
40 std::cout << reset_position;
41 screen.Print();
42 reset_position = screen.ResetPosition();
43
44 std::this_thread::sleep_for(0.1s);
45 }
46 std::cout << std::endl;
47}
auto screen
void Render(Screen &screen, const Element &element)
Affiche un élément sur un ftxui::Screen.
Definition node.cpp:83
L'espace de noms FTXUI ftxui::
Definition animation.hpp:10