14const std::vector<std::vector<std::vector<std::string>>> elements = {
16 {
"Replaced by the gauge"},
136 {
"(*----------)"}, {
"(-*---------)"}, {
"(--*--------)"},
137 {
"(---*-------)"}, {
"(----*------)"}, {
"(-----*-----)"},
138 {
"(------*----)"}, {
"(-------*---)"}, {
"(--------*--)"},
139 {
"(---------*-)"}, {
"(----------*)"}, {
"(---------*-)"},
140 {
"(--------*--)"}, {
"(-------*---)"}, {
"(------*----)"},
141 {
"(-----*-----)"}, {
"(----*------)"}, {
"(---*-------)"},
142 {
"(--*--------)"}, {
"(-*---------)"},
256 {
" ",
"_______",
" "},
257 {
" ",
"______/",
" "},
258 {
" _",
"_____/ ",
" "},
259 {
" _ ",
"____/ \\",
" "},
260 {
" _ ",
"___/ \\ ",
" \\"},
261 {
" _ ",
"__/ \\ ",
" \\_"},
262 {
" _ ",
"_/ \\ ",
" \\_/"},
263 {
" _ ",
"/ \\ _",
" \\_/ "},
264 {
"_ ",
" \\ __",
" \\_/ "},
265 {
" ",
"\\ ___",
" \\_/ "},
266 {
" ",
" ___",
"\\_/ "},
267 {
" ",
" _____",
"_/ "},
268 {
" ",
" ______",
"/ "},
269 {
" ",
"_______",
" "},
280 if (charset_index <= 0) {
281 const int progress_size = 40;
282 image_index %= progress_size;
283 if (image_index > progress_size / 2) {
284 image_index = progress_size - image_index;
286 return gauge(
float(image_index) * 0.05F);
288 charset_index %= int(elements.size());
289 image_index %= int(elements[charset_index].
size());
290 std::vector<Element> lines;
291 for (
const auto& it : elements[charset_index][image_index]) {
292 lines.push_back(
text(it));
294 return vbox(std::move(lines));
Decorator size(WidthOrHeight, Constraint, int value)
对元素大小应用约束。
Element spinner(int charset_index, size_t image_index)
用于表示时间或事件的效果。这显示了一个 ASCII 艺术“视频”。
Element text(std::wstring text)
显示一段Unicode文本。
Element vbox(Elements)
垂直一个接一个显示元素的容器。
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase
std::shared_ptr< Node > Element
Element gauge(float progress)
绘制一个高清进度条。