FTXUI 6.1.9
C++ functional terminal UI.
载入中...
搜索中...
未找到
blink.cpp
浏览该文件的文档.
1// Copyright 2020 Arthur Sonzogni. 保留所有权利。
2// 此源代码受 MIT 许可证的约束,可在
3// LICENSE 文件中找到。
4#include <memory> // for make_shared
5#include <utility> // for move
6
7#include "ftxui/dom/elements.hpp" // for Element, blink
8#include "ftxui/dom/node.hpp" // for Node
9#include "ftxui/dom/node_decorator.hpp" // for NodeDecorator
10#include "ftxui/screen/box.hpp" // for Box
11#include "ftxui/screen/screen.hpp" // for Pixel, Screen
12
13namespace ftxui {
14
15namespace {
16class Blink : public NodeDecorator {
17 public:
19
20 void Render(Screen& screen) override {
21 Node::Render(screen);
22 for (int y = box_.y_min; y <= box_.y_max; ++y) {
23 for (int x = box_.x_min; x <= box_.x_max; ++x) {
24 screen.PixelAt(x, y).blink = true;
25 }
26 }
27 }
28};
29} // namespace
30
31/// @brief 绘制的文本在可见和隐藏之间交替。
32/// @ingroup dom
34 return std::make_shared<Blink>(std::move(child));
35}
36
37} // namespace ftxui
friend void Render(Screen &screen, Node *node, Selection &selection)
void Render(Screen &screen, const Element &element)
在 ftxui::Screen 上显示元素。
Element blink(Element)
绘制的文本在可见和隐藏之间交替。
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase
std::shared_ptr< Node > Element