Inheritance diagram for nrEngine::Timer:
Public Member Functions | |
Timer (Clock &clock) | |
virtual | ~Timer () |
float64 | getTime () const |
float32 | getFrameInterval () const |
float32 | getRealFrameInterval () const |
bool | isPaused () const |
float32 | getScale () const |
void | setPause (bool bOn) |
void | setScale (float32 fScale) |
virtual void | notifyTimeObserver () |
void | setFixFrameRate (bool setFixRate, float32 fixFrameRate=60.0f) |
NR_FORCEINLINE void | resetObserver (float64 resetToTime=0.0f) |
Timer is an standard timer shipped with the engine. You can create your own timers because they are specialized for your application. This timer can only ticks and provide user with information he/she need. Also this timer supports scaling and pausing, so you are able to use at lesser speed or hold on parts of your game using this timer.
Definition at line 42 of file Timer.h.
nrEngine::Timer::Timer | ( | Clock & | clock | ) |
Define default values and set clock for using with this timer. This timer will automaticly be added to the clock as observer.
Definition at line 22 of file Timer.cpp.
References setFixFrameRate(), setPause(), and setScale().
nrEngine::Timer::~Timer | ( | ) | [virtual] |
float64 nrEngine::Timer::getTime | ( | ) | const |
float32 nrEngine::Timer::getFrameInterval | ( | ) | const |
float32 nrEngine::Timer::getRealFrameInterval | ( | ) | const |
Returns real frame interval based on Clock::getRealFrameInterval();
Definition at line 62 of file Timer.cpp.
References nrEngine::Clock::getRealFrameInterval().
bool nrEngine::Timer::isPaused | ( | ) | const |
float32 nrEngine::Timer::getScale | ( | ) | const |
void nrEngine::Timer::setPause | ( | bool | bOn | ) |
void nrEngine::Timer::setScale | ( | float32 | fScale | ) |
void nrEngine::Timer::notifyTimeObserver | ( | ) | [virtual] |
This function will be always called by clock. Here the main update of the timer is done.
Implements nrEngine::ITimeObserver.
Definition at line 41 of file Timer.cpp.
References nrEngine::Clock::getFrameInterval().
void nrEngine::Timer::setFixFrameRate | ( | bool | setFixRate, | |
float32 | fixFrameRate = 60.0f | |||
) |
If you set this to true so fix frame rate will be used. This helps us to run our application on console or do internal calculations based on fix frame rate like Doom3 does.
setFixRate | if true fix frame rate will be used. | |
fixFrameRate | frame rate to be used |
Definition at line 55 of file Timer.cpp.
Referenced by Timer().
NR_FORCEINLINE void nrEngine::Timer::resetObserver | ( | float64 | resetToTime = 0.0f |
) | [virtual] |
Reset the timer, so it start count the time from the value you define
Implements nrEngine::ITimeObserver.
Definition at line 138 of file Timer.h.
References nrEngine::ITimeObserver::getObserverID(), and nrEngine::Log::LOG_ENGINE.