FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
html_like.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/screen/screen.hpp> // for Screen
5#include <iostream> // for cout, ostream
6#include <string> // for allocator, operator<<, string
7#include <thread> // for sleep_for
8
9#include "ftxui/dom/elements.hpp" // for paragraph, text, operator|, Element, border, Fit, color, hflow, spinner, vbox, bold, dim, underlined
10#include "ftxui/dom/node.hpp" // for Render
11#include "ftxui/screen/box.hpp" // for ftxui
12#include "ftxui/screen/color.hpp" // for Color, Color::Red
13
14int main() {
15 using namespace ftxui;
16 using namespace std::chrono_literals;
17
18 auto img1 = []() { return text("img") | border; };
19 auto img2 = []() { return vbox({text("big"), text("image")}) | border; };
20
21 std::string reset_position;
22 for (int i = 0;; ++i) {
23 auto document = //
24 hflow(
25 paragraph("こんにちは世界!ここに画像があります:"), img1(),
26 paragraph(" ここにテキストがあります "), text("underlined ") | underlined,
27 paragraph(" ここにテキストがあります "), text("bold ") | bold,
28 paragraph("こんにちは世界!ここに画像があります:"), img2(),
29 paragraph(
30 "Lorem Ipsumは、印刷前の組版とレイアウトに使用される単なるダミーテキストです。Lorem Ipsumは、1500年代に匿名の印刷業者が活字見本帳を作成するためにテキストの断片を組み合わせて以来、印刷業界の標準ダミーテキストです。それは5世紀以上にわたって生き残っただけでなく、その内容が変更されることなく、電子組版にも適応しました。1960年代には、Lorem Ipsumのパッセージを含むLetrasetシートのリリースによって普及し、さらに最近では、Aldus PageMakerのようなデスクトップパブリッシングアプリケーションにそのバージョンが組み込まれています。"),
31 paragraph(" ここにテキストがあります "), text("dim ") | dim,
32 paragraph("こんにちは世界!ここに画像があります:"), img1(),
33 paragraph(" ここにテキストがあります "), text("red ") | color(Color::Red),
34 paragraph(" スピナー "), spinner(6, i / 10)) |
35 border;
36
37 auto screen = Screen::Create(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.01s);
44 }
45
46 return 0;
47}
Element border(Element child)
要素の周囲にボーダーを描画します。
int main()
Definition html_like.cpp:14
FTXUI ftxui:: 名前空間
Definition animation.hpp:9