Skip to content

Is is possible to continuous redraw? #555

Answered by ArthurSonzogni
btraquair asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @btraquair!
There is an example on the wiki: https://github.com/ArthurSonzogni/FTXUI/wiki/Screen#force-redraw

It uses a thread to periodically post event/task/animation:

screen_interactive.PostEvent(Event::Custom)

or

screen_interactive.RequestAnimationFrame();

If you don't want to add a thread, you can use the Loop to interleave ftxui loop with it:

  Loop loop(&screen, component);
  int interation = 0;
  while (!loop.HasQuitted()) {
    loop.RunOnce();
    std::this_thread::sleep_for(std::chrono::milliseconds(10));

    interaction++;
    if (iteration % 10 == 0)
      screen.RequestAnimationFrame();
  }

Does it work?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@btraquair
Comment options

Answer selected by btraquair
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants