#include <stdlib.h>
#include <chrono>
#include <memory>
#include <string>
#include <thread>
int main() {
int custom_loop_count = 0;
int frame_count = 0;
int event_count = 0;
frame_count++;
text(
"This demonstrates using a custom ftxui::Loop. It "),
text(
"runs at 100 iterations per seconds. The FTXUI events "),
text(
"are all processed once per iteration and a new frame "),
text(
"is rendered as needed"),
}) |
});
event_count++;
return false;
});
Loop loop(&screen, component);
while (!loop.HasQuitted()) {
custom_loop_count++;
loop.RunOnce();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
return EXIT_SUCCESS;
}
static ScreenInteractive FitComponent()
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
std::string to_string(const std::wstring &s)
Convert a UTF8 std::string into a std::wstring.
Element text(std::wstring text)
Display a piece of unicode text.
Component CatchEvent(Component child, std::function< bool(Event)>)
Element separator()
Draw a vertical or horizontal separation in between two other elements.
Element border(Element)
Draw a border around the element.
Element vbox(Elements)
A container displaying elements vertically one by one.