CRM32Pro SDK  v5.22
List of all members | Public Member Functions | Friends
CRM32Pro_ITimeSystem Class Reference

ITimeSystem. More...

Detailed Description

ITimeSystem.

Time system interface class.

Public Member Functions

int GetCurrentLFR ()
 Get current Logic Frame Rate (in real time) More...
 
int GetCurrentRFR ()
 Get current Rendering Frame Rate (in real time) More...
 
int GetDesiredLFR ()
 Get desired Logic Frame Rate. More...
 
int GetDesiredRFR ()
 Get desired Rendering Frame Rate. More...
 
float GetLFR ()
 Get the average Logic Frame Rate. More...
 
int GetLogicFrames ()
 Get total logic frames until now. More...
 
int GetRenderedFrames ()
 Get total rendered frames until now. More...
 
float GetRFR ()
 Get the average Rendering Frame Rate. More...
 
float GetSeconds ()
 Get the execution time since the last timer init or reset in seconds. More...
 
int GetTime ()
 Get the execution time since the last timer init or reset in milliseconds. More...
 
int GetTimeNow ()
 Get the execution time since the last timer init or reset in milliseconds. More...
 
void Info ()
 Print a lot of useful information about timer interface.
 
void Init (int mode=TIMER_INIT)
 Initialize timer system. More...
 
void SetRate (unsigned int r, unsigned int l)
 Set desired Rendering and Logic Frame Rate. More...
 

Friends

class CRM32Pro_IScreenFX
 
class CRM32Pro_IVideo
 
class CRM32Pro_Main
 

Member Function Documentation

int CRM32Pro_ITimeSystem::GetCurrentLFR ( )

Get current Logic Frame Rate (in real time)

Returns
-1 Failed
an integer variable with the current Logic Frame Rate.
int CRM32Pro_ITimeSystem::GetCurrentRFR ( )

Get current Rendering Frame Rate (in real time)

Returns
-1 Failed
an integer variable with the current Rendering Frame Rate.
Examples:
Example08_SpriteCollision.cpp, and Example09_LogicRenderRates.cpp.
int CRM32Pro_ITimeSystem::GetDesiredLFR ( )

Get desired Logic Frame Rate.

Returns
-1 Failed
an integer with desired logic rate
Examples:
Example09_LogicRenderRates.cpp.
int CRM32Pro_ITimeSystem::GetDesiredRFR ( )

Get desired Rendering Frame Rate.

Returns
-1 Failed
an integer with desired rendering rate
Examples:
Example09_LogicRenderRates.cpp.
float CRM32Pro_ITimeSystem::GetLFR ( )

Get the average Logic Frame Rate.

Returns
-1 Failed
a float variable with the average of Logic Frame Rate.
int CRM32Pro_ITimeSystem::GetLogicFrames ( )

Get total logic frames until now.

Returns
-1 Failed
an integer variable with the total number of logic frames.
int CRM32Pro_ITimeSystem::GetRenderedFrames ( )

Get total rendered frames until now.

Returns
-1 Failed
an integer variable with the total number of rendered frames.
float CRM32Pro_ITimeSystem::GetRFR ( )

Get the average Rendering Frame Rate.

Returns
-1 Failed
a float variable with the average of Rendering Frame Rate.
float CRM32Pro_ITimeSystem::GetSeconds ( )

Get the execution time since the last timer init or reset in seconds.

Returns
-1 Failed
a float variable with the execution time(in seconds) since Init().
Examples:
SpacePong.cpp.
int CRM32Pro_ITimeSystem::GetTime ( )

Get the execution time since the last timer init or reset in milliseconds.

The time returned is updated internally by CRM32Pro.Update(). If you have performed some operations or are outside a CRM32Pro.Update() loop it could be unaccurate. This behaviour is on purpose to keep the same time during a loop iteration. However, if you want to have the time now, use GetTimeNow() instead.

Returns
-1 Failed
an integer variable with the execution time(in milliseconds) since the last timer init or reset(including CRM32Pro.CleanUp() call).
Examples:
Example08_SpriteCollision.cpp, and Example09_LogicRenderRates.cpp.
int CRM32Pro_ITimeSystem::GetTimeNow ( )

Get the execution time since the last timer init or reset in milliseconds.

It returns the time now and does not depend on any external update like GetTime().

Returns
-1 Failed
an integer variable with the execution time(in milliseconds) since the last timer init or reset(including CRM32Pro.CleanUp() call).
void CRM32Pro_ITimeSystem::Init ( int  mode = TIMER_INIT)

Initialize timer system.

With TIMER_INIT, it initializes or resets all settings of the timer.
With TIMER_RESET, it only resets the timer if it was previously initialized
keeping RFR and LFR at previous assigned rates.
Note that Init(TIMER_RESET) is called internally by CRM32Pro.CleanUp().

Parameters
modeTIMER_INIT or TIMER_RESET. By default, TIMER_INIT is selected.
Examples:
Example01_BasicCode.cpp, Example03_GUI.cpp, Example08_SpriteCollision.cpp, Example09_LogicRenderRates.cpp, Example12_DRTS.cpp, and SpacePong.cpp.
void CRM32Pro_ITimeSystem::SetRate ( unsigned int  r,
unsigned int  l 
)

Set desired Rendering and Logic Frame Rate.

By default, there are not rate limits. Rendering Frame Rate(RFR) is asynchronous and it does not stop your main loop, it only dumps to video screen at desired rate, in addition, this value can not be guaranteed due to some frames could be dropped to hold stable the Logic Rate.
On the other hand, Logic Frame Rate(LFR) will slow your main loop to given rate. This rate will be stable in a normal situation.
When you are using doublebuffer, the best value for RFR is 0 to match the vertical retrace and to get the smoothest animation.

Parameters
ran integer value with desired Rendering Frame Rate. Maximum value is 120. Use 0 if you do not want to limit it.
lan integer value with desired Logic Frame Rate. Maximum value is 200. Use 0 if you do not want to limit it.
Examples:
Example01_BasicCode.cpp, Example03_GUI.cpp, Example08_SpriteCollision.cpp, Example09_LogicRenderRates.cpp, Example12_DRTS.cpp, and SpacePong.cpp.

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