foxygit / Torlinkc Log in
commits tags

/include/torlinkc/ui/clock.hpp · 670 B

raw
#pragma once

#include <functional>

#include <ftxui/component/component.hpp>

namespace torlinkc::ui {

// Advances *clock by elapsed seconds every animation frame while isActive()
// is true (wrapped to stay bounded over a long-running session), and costs
// nothing while inactive -- same pattern as spinner.hpp. Drives the
// downloads progress-bar sheen, so a page of active downloads sweeps in
// sync. The caller must still call
// ScreenInteractive::RequestAnimationFrame() once to kick off the first
// frame when isActive() flips true (see spinner.hpp).
ftxui::Component MakeUiClock(float* clock, std::function<bool()> isActive);

}  // namespace torlinkc::ui