FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
examples/dom/spinner.cpp
Go to the documentation of this file.
1// Copyright 2020 Arthur Sonzogni. All rights reserved.
2// このソースコードの使用は、LICENSEファイルにあるMITライセンスに準拠しています。
3#include <chrono> // for operator""s, chrono_literals
4#include <ftxui/dom/elements.hpp> // for Element, operator|, separator, filler, hbox, size, spinner, text, vbox, bold, border, Fit, EQUAL, WIDTH
5#include <ftxui/screen/screen.hpp> // for Full, Screen
6#include <iostream> // for cout, endl, ostream
7#include <string> // for to_string, operator<<, string
8#include <thread> // for sleep_for
9#include <utility> // for move
10#include <vector> // for vector
11
12#include "ftxui/dom/node.hpp" // for Render
13#include "ftxui/screen/color.hpp" // for ftxui
14
15int main() {
16 using namespace ftxui;
17 using namespace std::chrono_literals;
18
19 std::string reset_position;
20 for (int index = 0; index < 200; ++index) {
21 std::vector<Element> entries;
22 for (int i = 0; i < 23; ++i) {
23 if (i != 0) {
24 entries.push_back(separator());
25 }
26 entries.push_back( //
27 hbox({
28 text(std::to_string(i)) | size(WIDTH, EQUAL, 2),
29 separator(),
30 spinner(i, index) | bold,
31 }));
32 }
33 auto document = hbox({
34 vbox(std::move(entries)) | border,
35 filler(),
36 });
37 auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
38 Render(screen, document);
39 std::cout << reset_position;
40 screen.Print();
41 reset_position = screen.ResetPosition();
42
43 std::this_thread::sleep_for(0.1s);
44 }
45 std::cout << std::endl;
46}
Element border(Element child)
要素の周囲にボーダーを描画します。
FTXUI ftxui:: 名前空間
Definition animation.hpp:9
return size
Definition string.cpp:1516