FTXUI 6.1.9
C++ functional terminal UI.
载入中...
搜索中...
未找到
automerge.cpp
浏览该文件的文档.
1// 版权所有 2020 Arthur Sonzogni。保留所有权利。
2// 本源代码的使用受 MIT 许可证的约束,该许可证可在 LICENSE 文件中找到。
3#include <memory> // for make_shared
4#include <utility> // for move
5
6#include "ftxui/dom/elements.hpp" // for Element, automerge
7#include "ftxui/dom/node.hpp" // for Node
8#include "ftxui/dom/node_decorator.hpp" // for NodeDecorator
9#include "ftxui/screen/box.hpp" // for Box
10#include "ftxui/screen/screen.hpp" // for Pixel, Screen
11
12namespace ftxui {
13
14/// @brief 启用字符自动与附近的其它字符合并。
15/// @ingroup dom
17 class Impl : public NodeDecorator {
18 public:
19 using NodeDecorator::NodeDecorator;
20
21 void Render(Screen& screen) override {
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).automerge = true;
25 }
26 }
27 Node::Render(screen);
28 }
29 };
30
31 return std::make_shared<Impl>(std::move(child));
32}
33
34} // namespace ftxui
Element automerge(Element child)
启用字符自动与附近的其它字符合并。
Pixel & PixelAt(int x, int y)
访问给定位置的单元格 (Pixel)。
像素的矩形网格。
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase
std::shared_ptr< Node > Element