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