#include <framerate.h>
Public Member Functions | |
FrameRate () | |
Class constructor. | |
float | GetFPS () const |
Update and get frames per second. | |
void | IncFrame () |
Increment frame counter and update framerate. | |
Protected Attributes | |
unsigned long | totalFrames |
Total frames counted. | |
unsigned long | lastFrames |
totalFrames value from last notification | |
float | fps |
Frames per second. | |
wxStopWatch | stopWatch |
Stop watch for precise timing. |
Definition at line 21 of file framerate.h.
VRUT::FrameRate::FrameRate | ( | ) | [inline] |
Class constructor.
Definition at line 35 of file framerate.h.
00036 { 00037 totalFrames = lastFrames = 0; 00038 fps = 0; 00039 }
float VRUT::FrameRate::GetFPS | ( | ) | const [inline] |
Update and get frames per second.
Definition at line 42 of file framerate.h.
00043 { 00044 return fps; 00045 }
void VRUT::FrameRate::IncFrame | ( | ) | [inline] |
Increment frame counter and update framerate.
Definition at line 48 of file framerate.h.
00049 { 00050 totalFrames++; 00051 long currTime = stopWatch.Time(); 00052 if (currTime > 500) 00053 { 00054 fps = 1000.0f * double(totalFrames - lastFrames) / double(currTime); 00055 if (totalFrames > 0x0fffffff) 00056 totalFrames = 0; 00057 lastFrames = totalFrames; 00058 stopWatch.Start(); 00059 } 00060 }
unsigned long VRUT::FrameRate::totalFrames [protected] |
unsigned long VRUT::FrameRate::lastFrames [protected] |
float VRUT::FrameRate::fps [protected] |
wxStopWatch VRUT::FrameRate::stopWatch [protected] |