21 using clock_t = std::chrono::steady_clock;
24 using delta_t = std::chrono::duration<float>;
Class responsible for timers.
std::vector< duration_t > previous_timesteps_
previous time steps for smoothing in seconds
auto get_delta_time() const -> delta_t
Returns the delta time in seconds.
auto get_time_scale() const -> float
auto get_fps() const -> float
Returns frames per second.
void set_time_scale(float time_scale=1.0f)
void set_time_smoothing_step(uint32_t step)
Set how many frames to average for timestep smoothing.
timepoint_t last_frame_timepoint_
frame update timer
duration_t timestep_
next frame time step in seconds
void set_max_inactive_fps(uint32_t fps)
Set maximum frames per second when the application does not have input focus.
uint32_t smoothing_step_
how many frames to average for the smoothed time step
void run_one_frame(bool is_active)
Perform on frame computations with specified fps.
auto get_frame() const -> uint64_t
auto get_time_since_launch() const -> duration_t
Returns duration since launch.
std::chrono::duration< float > delta_t
std::chrono::steady_clock clock_t
uint32_t max_inactive_fps_
uint64_t frame_
current frame
clock_t::time_point timepoint_t
void set_max_fps(uint32_t fps)
Set maximum frames per second. The engine will sleep if fps is higher than this.
void set_min_fps(uint32_t fps)
Set minimum frames per second. If fps goes lower than this, time will appear to slow.
timepoint_t launch_timepoint_
time point when we launched
clock_t::duration duration_t
uint32_t min_fps_
minimum/maximum frames per second