17 using namespace ftxui;
18 auto screen = ScreenInteractive::FitComponent();
21 int custom_loop_count = 0;
24 auto component = Renderer([&] {
27 text(
"This demonstrates using a custom ftxui::Loop. It "),
28 text(
"runs at 100 iterations per seconds. The FTXUI events "),
29 text(
"are all processed once per iteration and a new frame "),
30 text(
"is rendered as needed"),
32 text(
"ftxui event count: " + std::to_string(event_count)),
33 text(
"ftxui frame count: " + std::to_string(frame_count)),
34 text(
"Custom loop count: " + std::to_string(custom_loop_count)),
39 component |= CatchEvent([&](
Event) ->
bool {
44 Loop loop(&screen, component);
46 while (!loop.HasQuitted()) {
49 std::this_thread::sleep_for(std::chrono::milliseconds(10));