SDEngine
Game Engine
Loading...
Searching...
No Matches
sd::FrameTimer Class Reference

Tracks frame timing, fixed timestep accumulation, and CPU work time. More...

#include <FrameTimer.hpp>

Public Member Functions

void begin ()
 
void begin_work ()
 
void end_work ()
 
bool consume_fixed_step ()
 Returns true if a fixed step should run. Call in a loop.
 
void add_gpu_wait_time (float t)
 
float get_frame_time () const
 
float get_frame_work_time () const
 
double get_fixed_time_step () const
 
void set_fixed_time_step (double step)
 

Private Attributes

double m_last_time = 0.0
 
double m_accumulator = 0.0
 
double m_fixed_time_step = 1.0 / 60.0
 
double m_work_start = 0.0
 
float m_frame_work_time = 0.0f
 
float m_gpu_wait_time = 0.0f
 
double m_frame_time = 0.0
 

Detailed Description

Tracks frame timing, fixed timestep accumulation, and CPU work time.

Member Function Documentation

◆ add_gpu_wait_time()

void sd::FrameTimer::add_gpu_wait_time ( float  t)
inline

◆ begin()

void sd::FrameTimer::begin ( )
inline

◆ begin_work()

void sd::FrameTimer::begin_work ( )
inline

◆ consume_fixed_step()

bool sd::FrameTimer::consume_fixed_step ( )
inline

Returns true if a fixed step should run. Call in a loop.

◆ end_work()

void sd::FrameTimer::end_work ( )
inline

◆ get_fixed_time_step()

double sd::FrameTimer::get_fixed_time_step ( ) const
inline

◆ get_frame_time()

float sd::FrameTimer::get_frame_time ( ) const
inline

◆ get_frame_work_time()

float sd::FrameTimer::get_frame_work_time ( ) const
inline

◆ set_fixed_time_step()

void sd::FrameTimer::set_fixed_time_step ( double  step)
inline

Member Data Documentation

◆ m_accumulator

double sd::FrameTimer::m_accumulator = 0.0
private

◆ m_fixed_time_step

double sd::FrameTimer::m_fixed_time_step = 1.0 / 60.0
private

◆ m_frame_time

double sd::FrameTimer::m_frame_time = 0.0
private

◆ m_frame_work_time

float sd::FrameTimer::m_frame_work_time = 0.0f
private

◆ m_gpu_wait_time

float sd::FrameTimer::m_gpu_wait_time = 0.0f
private

◆ m_last_time

double sd::FrameTimer::m_last_time = 0.0
private

◆ m_work_start

double sd::FrameTimer::m_work_start = 0.0
private

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