A simple helper class that measures the frame rate of a MASkinG program.
Public Methods
-
void Init(int samples)
- Initializes the object.
-
void Tick()
- Records a logic tick.
-
void Frame()
- Records a frame.
-
int Get()
- Returns the framerate.
Documentation
A simple helper class that measures the frame rate of a MASkinG program. The
frame rate is measured by calculating a running average over a short period of
time. There is a global instance of this class defined in the MAS namespace
named globalFpsCounter. This object is initialized and updated automatically
by the dialog that is being executed and is queried by any instance of the
FPS widget that is present in the dialog. Note that the calculations this
class performs depend on the value of Settings::logicFramerate. The Init method
is called in Dialog::MsgStart() and the update methods are called in Dialog::MsgIdle().
This means that if you don't use the Settings class and/or run your own main
loop, the globalFpsCounter object won't work unless you initialize and update
it yourself as is indicated in this documentation.
void Init(int samples)
-
Initializes the object.
This function should be called at the same time as when the timer
that runs the main loop is started.
- Parameters:
- samples - The target logic framerate. This is the number of times
per second that the logic portion of the main loop is executed.
void Tick()
-
Records a logic tick.
This function must be called exactly once per logic update.
void Frame()
-
Records a frame.
This function must be called exactly once every time a new frame has
been rendered. Typically this is after blitting the backbuffer to the
screen or flipping video pages.
int Get()
-
Returns the framerate.
- Returns:
- The average framerate over the last second.
- This class has no child classes.
- See Also:
- Settings
FPS
Alphabetic index Hierarchy of classes
Back to front page
|
page generated with DOC++