![]() |
CRM64Pro GDK
v0.94
A free cross-platform game development kit built on top of SDL 2.0
|
Classes | |
class | CRM64Pro::Timer |
Functions | |
Sint32 | CRM64Pro::Timer::info (Sint32 iMode=0) |
Sint32 | CRM64Pro::Timer::init (eTimerState tsOpt=TS_INIT) |
Sint32 | CRM64Pro::Timer::setRate (Uint16 iR, Uint16 iL) |
Sint32 | CRM64Pro::Timer::getLFR () |
Sint32 | CRM64Pro::Timer::getRFR () |
float | CRM64Pro::Timer::getAverageRFR () |
float | CRM64Pro::Timer::getAverageLFR () |
Uint32 | CRM64Pro::Timer::getCurrentRFR () |
Uint32 | CRM64Pro::Timer::getCurrentLFR () |
Uint32 | CRM64Pro::Timer::getRenderFrames () |
Uint32 | CRM64Pro::Timer::getLogicFrames () |
float | CRM64Pro::Timer::getTime () |
Uint32 | CRM64Pro::Timer::getTicks () |
Uint32 | CRM64Pro::Timer::getTicksNow () |
The Timer must be initiated with Timer::init().
Apart from methods for getting time, fixed virtual logic frame rate with interpolation feature is implemented on this interface and in Main::update() method:
By default, no preferred Render and Logic Frame Rate are set (they are equal to 0) so if you want to use specific values, you must use setRate().
The rates can be adjusted (throttle down) but the upper limit is imposed by the underlying hardware where the application is executed, there is also a synergy between upper limits and ConfigMgr::iMTFriendly value.
It is important to say that the Render Frame Rate (if enabled) will be used for all enabled and visible screens.
Only a single instance of the Timer interface exists which is created once Main is instantiated.
You can get a reference to this interface using Main::ITimer() method.
Timer init state.
Enumerator | |
---|---|
TS_INIT |
'tsOpt' parameter in Timer::init(), initializes or resets all timer settings. |
TS_RESET |
'tsOpt' parameter in Timer::init(), only resets the timer if it was previously initialized keeping RFR and LFR rates. |
Sint32 CRM64Pro::Timer::info | ( | Sint32 | iMode = 0 | ) |
Request Timer Interface information.
For displaying the information, it uses the default log.
iMode | unused for the time being. |
Sint32 CRM64Pro::Timer::init | ( | eTimerState | tsOpt = TS_INIT | ) |
Initialize the timer system.
The first call to this method, SDL timer subsystem will be initialized.
tsOpt | Check eTimerState enum for further information. By default TS_INIT is set. |
Sint32 CRM64Pro::Timer::setRate | ( | Uint16 | iR, |
Uint16 | iL | ||
) |
Set preferred Render and Logic Frame Rate.
iR | an integer value with preferred Render Frame Rate. By default it is set to 0 which does not limit this rate. Maximum value is 500. |
iL | an integer value with preferred Logic Frame Rate. By default it is set to 0 which does not limit this rate. Maximum value is 500. |
Sint32 CRM64Pro::Timer::getLFR | ( | ) |
Get the preferred Logic Frame Rate.
Sint32 CRM64Pro::Timer::getRFR | ( | ) |
Get the preferred Render Frame Rate.
float CRM64Pro::Timer::getAverageRFR | ( | ) |
Get the average Render Frame Rate since the last timer init or reset.
float CRM64Pro::Timer::getAverageLFR | ( | ) |
Get the average Logic Frame Rate since the last timer init or reset.
Uint32 CRM64Pro::Timer::getCurrentRFR | ( | ) |
Get current Render Frame Rate during last recent second.
Uint32 CRM64Pro::Timer::getCurrentLFR | ( | ) |
Get current Logic Frame Rate during last recent second.
Uint32 CRM64Pro::Timer::getRenderFrames | ( | ) |
Get total render frames since the last timer init or reset.
Uint32 CRM64Pro::Timer::getLogicFrames | ( | ) |
Get total logic frames since the last timer init or reset.
float CRM64Pro::Timer::getTime | ( | ) |
Get the execution time (in seconds) since the last timer init or reset.
This time will be constant inside the same Logic Frame iteration and will be updated on Main::update() if a new Logic Frame must be produced.
Uint32 CRM64Pro::Timer::getTicks | ( | ) |
Get the execution time (in milliseconds) since the last timer init or reset.
This time will be constant inside the same Logic Frame iteration and will be updated on Main::update() if a new Logic Frame must be produced.
Uint32 CRM64Pro::Timer::getTicksNow | ( | ) |
Get the execution time (in milliseconds) since the last timer init or reset.
This time will be exactly the "now" time, on other words, it is not linked anyway to the Logic Frame iteration.