21 void Tick(int64_t nowNanos,
float refreshHz);
24 double Seconds()
const {
return m_seconds; }
29 int64_t m_originNanos = 0;
30 bool m_started =
false;
31 double m_seconds = 0.0;
32 double m_deltaSeconds = 0.0;
72 bool m_locked =
false;
Animation time locked to the display refresh.
Definition gui_frame_clock.h:17
double Seconds() const
Seconds since the first Tick.
Definition gui_frame_clock.h:24
double DeltaSeconds() const
Seconds the last Tick advanced; 0 on the first.
Definition gui_frame_clock.h:26
void Tick(int64_t nowNanos, float refreshHz)
Advances the clock; call once per frame, before anything reads the time.
Whether frames are locked to the vsync, told by how long presenting them waited.
Definition gui_frame_clock.h:58
bool IsLocked() const
Definition gui_frame_clock.h:68
static constexpr double kWaitedShare
The share of a refresh period present must wait to count as a vsync wait.
Definition gui_frame_clock.h:63
static constexpr int kFramesToSwitch
Presents in a row that waited, or didn't, before the lock changes.
Definition gui_frame_clock.h:61
void NotePresent(double presentSeconds, float refreshHz)
After presenting a frame: the seconds present took; refreshHz 0 when unknown, which counts as not wai...
constexpr double kFramePaceMinWaitSeconds
A wait shorter than this is skipped: it costs about as much as it saves.
Definition gui_frame_clock.h:40
double FramePaceWaitSeconds(int64_t frameStartNanos, int64_t nowNanos, float refreshHz)
How long to wait after presenting a frame, in seconds, so the loop doesn't run faster than the displa...
constexpr double kFramePaceShare
The share of a refresh period a frame takes at least when GUIApplication::Run paces it.
Definition gui_frame_clock.h:38
Definition gui_logging.h:24