FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
examples/dom/gridbox.cpp
Go to the documentation of this file.
1// 版權所有 2021 Arthur Sonzogni. 保留所有權利。
2// 本原始碼的使用受 MIT 授權條款約束,該條款可在 LICENSE 檔案中找到。
3#include <stdio.h> // for getchar
4#include <ftxui/dom/elements.hpp> // for Elements, gridbox, Fit, operator|, text, border, Element
5#include <ftxui/screen/screen.hpp> // for Screen
6#include <memory> // for allocator, shared_ptr
7
8#include "ftxui/dom/node.hpp" // for Render
9#include "ftxui/screen/color.hpp" // for ftxui
10
11int main() {
12 using namespace ftxui;
13 auto cell = [](const char* t) { return text(t) | border; };
14 auto document = //
15 gridbox({
16 {
17 cell("north-west"),
18 cell("north"),
19 cell("north-east"),
20 },
21 {
22 cell("center-west"),
23 gridbox({
24 {
25 cell("center-north-west"),
26 cell("center-north-east"),
27 },
28 {
29 cell("center-south-west"),
30 cell("center-south-east"),
31 },
32 }),
33 cell("center-east"),
34 },
35 {
36 cell("south-west"),
37 cell("south"),
38 cell("south-east"),
39 },
40 });
41 auto screen = Screen::Create(Dimension::Fit(document));
42 Render(screen, document);
43 screen.Print();
44 getchar();
45
46 return 0;
47}
void Render(Screen &screen, const Element &element)
在 ftxui::Screen 上顯示元素。
Definition node.cpp:82
FTXUI 的 ftxui:: 命名空間
Definition animation.hpp:10