4#ifndef FTXUI_COMPONENT_LOOP_HPP
5#define FTXUI_COMPONENT_LOOP_HPP
14using Component = std::shared_ptr<ComponentBase>;
15class ScreenInteractive;
bool HasQuitted()
循环是否已退出。
Loop(const ScreenInteractive &)=delete
void Run()
执行循环,阻塞当前线程,直到循环退出。
Loop(ScreenInteractive *screen, Component component)
Loop 是 Component 和 ScreenInteractive 的包装器。 它用于在终端中运行 Component。
Loop & operator=(const Loop &)=delete
void RunOnce()
执行循环。使 component 处理所有待处理的任务/事件。 如果前一帧无效,可能会绘制新帧。 在循环完成之前返回 true。
Loop(const Loop &)=default
Loop & operator=(Loop &&)=delete
void RunOnceBlocking()
等待至少一个事件被处理并执行 Loop::RunOnce()。
ScreenInteractive 是一个可以处理事件、运行主循环和管理组件的 Screen。
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase
std::shared_ptr< ComponentBase > Component