TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::FrameClock Class Reference

Animation time locked to the display refresh. More...

#include <gui_core/frame/gui_frame_clock.h>

Public Member Functions

void Tick (int64_t nowNanos, float refreshHz)
 Advances the clock; call once per frame, before anything reads the time.
double Seconds () const
 Seconds since the first Tick.
double DeltaSeconds () const
 Seconds the last Tick advanced; 0 on the first.

Detailed Description

Animation time locked to the display refresh.

Frames reach the screen on vsyncs, a whole number of refresh periods after the previous one, but the CPU sees those intervals with jitter. The clock advances by whole periods, rounded against the wall clock, so animations step evenly and never drift from real time by more than half a period. Without a known refresh rate it follows the wall clock.

Member Function Documentation

◆ Tick()

void tachyon::FrameClock::Tick ( int64_t nowNanos,
float refreshHz )

Advances the clock; call once per frame, before anything reads the time.

nowNanos is a monotonic timestamp (SteadyClockNowNanos); refreshHz is 0 when unknown.

◆ Seconds()

double tachyon::FrameClock::Seconds ( ) const
inline

Seconds since the first Tick.

◆ DeltaSeconds()

double tachyon::FrameClock::DeltaSeconds ( ) const
inline

Seconds the last Tick advanced; 0 on the first.


The documentation for this class was generated from the following file: