mElite
1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
|
A class computing the current frame rate. More...
#include <FrameCounter.h>
Public Member Functions | |
FrameCounter (void) | |
Initializes the variables. | |
~FrameCounter (void) | |
Destructor. | |
void | update (void) |
Updates the current framerate if one second has passed since the last update. | |
long | getFrameStart (void) |
float | getFrameTimeAverage (void) |
Returns the time needed for drawing one frame. | |
long | getFrameTimeCurrent (void) |
Returns the time passed since the last frame started. | |
long | getFrameTimeLast (void) |
Returns the time passed since the last frame started. | |
long | getTime (void) |
void | newFrame (void) |
Increases the counted number of frames. | |
int | getFrameRateAverage (void) |
brief Returns the last calculated framerate. | |
A class computing the current frame rate.
Definition at line 9 of file FrameCounter.h.
FrameCounter::FrameCounter | ( | void | ) |
Initializes the variables.
The first start-time is set.
Definition at line 13 of file FrameCounter.cpp.
FrameCounter::~FrameCounter | ( | void | ) |
Destructor.
Definition at line 24 of file FrameCounter.cpp.
int FrameCounter::getFrameRateAverage | ( | void | ) |
brief Returns the last calculated framerate.
The framerate is actualized every second.
Definition at line 32 of file FrameCounter.cpp.
long FrameCounter::getFrameStart | ( | void | ) |
Definition at line 36 of file FrameCounter.cpp.
float FrameCounter::getFrameTimeAverage | ( | void | ) |
Returns the time needed for drawing one frame.
The time is an average value calculated by the last frames per seconds value.
Definition at line 44 of file FrameCounter.cpp.
long FrameCounter::getFrameTimeCurrent | ( | void | ) |
Returns the time passed since the last frame started.
Definition at line 51 of file FrameCounter.cpp.
long FrameCounter::getFrameTimeLast | ( | void | ) |
Returns the time passed since the last frame started.
Definition at line 60 of file FrameCounter.cpp.
long FrameCounter::getTime | ( | void | ) |
Definition at line 64 of file FrameCounter.cpp.
void FrameCounter::newFrame | ( | void | ) |
Increases the counted number of frames.
Needs to be called everytime when a new frame is painted to the screen.
Definition at line 72 of file FrameCounter.cpp.
void FrameCounter::update | ( | void | ) |
Updates the current framerate if one second has passed since the last update.
The elapsed time is calculated with the glutGet function which counts the milliseconds since start of the game.
Definition at line 84 of file FrameCounter.cpp.