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 |
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!
| BARE2D::Timer::Timer | ( | ) |
Definition at line 9 of file Timer.cpp.
References m_frameTime.
| 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:| double BARE2D::Timer::getDeltaTime | ( | ) |
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:| bool BARE2D::Timer::integrateFrame | ( | ) |
IntegrateFrame gives an indication of whether we should be updatign again with dt or if we should exit our loop.
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:| 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:| 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:
|
private |
Definition at line 44 of file Timer.hpp.
Referenced by endTimer(), getDeltaTime(), integrateFrame(), and Timer().
|
private |
Definition at line 43 of file Timer.hpp.
Referenced by getDeltaTime(), integrateFrame(), and setDeltaTimeLimit().
|
private |
Definition at line 45 of file Timer.hpp.
Referenced by endTimer(), and startTimer().