BARE2D
BARE2D::Timer Class Reference

Not only does the timer keep track of the current time and delta-times, it can do all the "fancy" calculations for timestepping! Uses semi-fixed timestepping, as this engine isn't going to be used for advanced physics! More...

#include <Timer.hpp>

+ Collaboration diagram for BARE2D::Timer:

Public Member Functions

 Timer ()
 
bool integrateFrame ()
 IntegrateFrame gives an indication of whether we should be updatign again with dt or if we should exit our loop. More...
 
double getDeltaTime ()
 
void startTimer ()
 To be called at the start of a frame. More...
 
void endTimer ()
 To be called at the end of a frame. More...
 
void setDeltaTimeLimit (double minDt)
 Sets the maximum value of dt. Naturally, there is no minimum. This doesn't take away from accuracy. Setting a maximum means we subdivide the frames if necessary. More...
 

Private Attributes

double m_minDeltaTime
 
double m_frameTime
 
std::chrono::steady_clock::time_point m_startTime
 

Detailed Description

Not only does the timer keep track of the current time and delta-times, it can do all the "fancy" calculations for timestepping! Uses semi-fixed timestepping, as this engine isn't going to be used for advanced physics!

Definition at line 11 of file Timer.hpp.

Constructor & Destructor Documentation

◆ Timer()

BARE2D::Timer::Timer ( )

Definition at line 9 of file Timer.cpp.

References m_frameTime.

Member Function Documentation

◆ endTimer()

void BARE2D::Timer::endTimer ( )

To be called at the end of a frame.

Definition at line 34 of file Timer.cpp.

References m_frameTime, and m_startTime.

Referenced by BARE2D::App::run().

+ Here is the caller graph for this function:

◆ getDeltaTime()

double BARE2D::Timer::getDeltaTime ( )
Returns
The dt variable for update integration.

Definition at line 24 of file Timer.cpp.

References m_frameTime, and m_minDeltaTime.

Referenced by BARE2D::App::run().

+ Here is the caller graph for this function:

◆ integrateFrame()

bool BARE2D::Timer::integrateFrame ( )

IntegrateFrame gives an indication of whether we should be updatign again with dt or if we should exit our loop.

Returns
True if we should continue to integrate the update function or False if we're good.

Definition at line 14 of file Timer.cpp.

References m_frameTime, and m_minDeltaTime.

Referenced by BARE2D::App::run().

+ Here is the caller graph for this function:

◆ setDeltaTimeLimit()

void BARE2D::Timer::setDeltaTimeLimit ( double  minDt)

Sets the maximum value of dt. Naturally, there is no minimum. This doesn't take away from accuracy. Setting a maximum means we subdivide the frames if necessary.

Definition at line 44 of file Timer.cpp.

References m_minDeltaTime.

Referenced by BARE2D::App::init().

+ Here is the caller graph for this function:

◆ startTimer()

void BARE2D::Timer::startTimer ( )

To be called at the start of a frame.

Definition at line 29 of file Timer.cpp.

References m_startTime.

Referenced by BARE2D::App::run().

+ Here is the caller graph for this function:

Field Documentation

◆ m_frameTime

double BARE2D::Timer::m_frameTime
private

Definition at line 44 of file Timer.hpp.

Referenced by endTimer(), getDeltaTime(), integrateFrame(), and Timer().

◆ m_minDeltaTime

double BARE2D::Timer::m_minDeltaTime
private

Definition at line 43 of file Timer.hpp.

Referenced by getDeltaTime(), integrateFrame(), and setDeltaTimeLimit().

◆ m_startTime

std::chrono::steady_clock::time_point BARE2D::Timer::m_startTime
private

Definition at line 45 of file Timer.hpp.

Referenced by endTimer(), and startTimer().


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