This is the documentation for Enlighten.

class Geo GeoFrameTime

class Geo::GeoFrameTime

    └>Geo::GeoSingleton< GeoFrameTime >

This class measures frame rate and also computes a running average of the last n frames.

It's designed as a singleton.

Variables

Name Description
tClass * m_Singleton = NULL

Pointer to the singleton instance or NULL if not started.

const float ms_DefaultFramerate

The framerate to return when there has not yet been enough samples.

const Geo::s32 ms_NumAverageFrames = 300

The number of frames to average over.

Functions

Name Description
~GeoFrameTime()

Destructor.

~GeoSingleton()

Destructor clears singleton pointer.

GeoFrameTime()

Constructor just sets up defaults.

GeoSingleton()

Constructor initialises singleton pointer.

Get()

Returns a pointer to the singleton instance.

GetAbsoluteTime()

Returns number of seconds since the beginning.

GetAverageFramesPerSecond()

Returns average of frame rate over a number of frames.

GetAverageFrameTime()

Returns frame time averaged over a number of frames.

GetConstFramerate()

Get the constant frame rate.

GetFrameNumber()

Returns number of update calls made.

GetFramesPerSecond()

Returns current frame rate.

GetFrameTime()

Returns length of last frame in seconds.

GetMaximumFrameTime()

Returns the maximum frame time over the same averaged period as GetAverageFrameTime()

IsAvailable()

Returns true if the singleton is available.

IsPaused()

Return true if we are paused.

IsRunningConstFramerate()

Find out if we're running with a constant frame rate.

Pause(bool)

Pause the timer, handles nested pause calls but they are to be avoided.

SetConstFramerate(bool, float)

Enable/disable constant frame rate mode and set rate.

Start()

Setup the singleton instance.

Stop()

Release the singleton instance.

Update()

Update the frame time - increments frame number and calculates frame time as elapsed time since last call.


Geo::GeoFrameTime::~GeoFrameTime


public: ~GeoFrameTime()


Destructor.


Geo::GeoSingleton< tClass >::~GeoSingleton


protected: ~GeoSingleton()


Destructor clears singleton pointer.


Geo::GeoFrameTime::GeoFrameTime


public: GeoFrameTime()


Constructor just sets up defaults.


Geo::GeoSingleton< tClass >::GeoSingleton


protected: GeoSingleton()


Constructor initialises singleton pointer.


tClass * Geo::GeoSingleton< tClass >::Get


public: tClass * Get()


Returns a pointer to the singleton instance.


double Geo::GeoFrameTime::GetAbsoluteTime


public: double GetAbsoluteTime() const


Returns number of seconds since the beginning.


float Geo::GeoFrameTime::GetAverageFramesPerSecond


public: float GetAverageFramesPerSecond() const


Returns average of frame rate over a number of frames.


float Geo::GeoFrameTime::GetAverageFrameTime


public: float GetAverageFrameTime() const


Returns frame time averaged over a number of frames.


float Geo::GeoFrameTime::GetConstFramerate


public: float GetConstFramerate() const


Get the constant frame rate.


Geo::u32 Geo::GeoFrameTime::GetFrameNumber


public: Geo::u32 GetFrameNumber() const


Returns number of update calls made.


float Geo::GeoFrameTime::GetFramesPerSecond


public: float GetFramesPerSecond() const


Returns current frame rate.


float Geo::GeoFrameTime::GetFrameTime


public: float GetFrameTime() const


Returns length of last frame in seconds.


float Geo::GeoFrameTime::GetMaximumFrameTime


public: float GetMaximumFrameTime() const


Returns the maximum frame time over the same averaged period as GetAverageFrameTime()


bool Geo::GeoSingleton< tClass >::IsAvailable


public: bool IsAvailable()


Returns true if the singleton is available.


bool Geo::GeoFrameTime::IsPaused


public: bool IsPaused() const


Return true if we are paused.


bool Geo::GeoFrameTime::IsRunningConstFramerate


public: bool IsRunningConstFramerate() const


Find out if we're running with a constant frame rate.


Geo::s32 Geo::GeoFrameTime::Pause


public: Geo::s32 Pause
(
    bool pause
)


Pause the timer, handles nested pause calls but they are to be avoided.


void Geo::GeoFrameTime::SetConstFramerate


public: void SetConstFramerate
(
    bool enable,
    float rate
)


Enable/disable constant frame rate mode and set rate.


bool Geo::GeoSingleton< tClass >::Start


public: bool Start()


Setup the singleton instance.


void Geo::GeoSingleton< tClass >::Stop


public: void Stop()


Release the singleton instance.


void Geo::GeoFrameTime::Update


public: void Update()


Update the frame time - increments frame number and calculates frame time as elapsed time since last call.

It is assumed that this function is called at the beginning of every frame, so when it is called the first time the frame time is unknown, so it will return FrameNumber == 0, FrameTime == 1/ms_DefaultFramerate, Framerate = ms_DefaultFramerate and AbsoluteTime == 0.