Initial commit
This commit is contained in:
commit
edfc5298e1
252 changed files with 93965 additions and 0 deletions
43
include/Spectre/Game/FPSCounter.h
Normal file
43
include/Spectre/Game/FPSCounter.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
#ifndef SPECTRE_FPS_COUNTER_H
|
||||
#define SPECTRE_FPS_COUNTER_H
|
||||
|
||||
// Simple FPS counter.
|
||||
|
||||
class FPSCounter
|
||||
{
|
||||
public :
|
||||
FPSCounter();
|
||||
|
||||
// Add a frame to the counter.
|
||||
// Should be called whenever a frame has been rendered.
|
||||
void addFrame();
|
||||
|
||||
float getFPS() const;
|
||||
|
||||
// Set the update rate (in seconds).
|
||||
// How often the FPS should be sampled and calculated.
|
||||
void setUpdateRate(unsigned int seconds);
|
||||
|
||||
// Update the internal time measurment.
|
||||
bool update();
|
||||
|
||||
// Reset the frame time
|
||||
void reset();
|
||||
|
||||
private :
|
||||
|
||||
// Frame counter.
|
||||
unsigned int m_count;
|
||||
|
||||
// time (in ms)
|
||||
unsigned int m_time;
|
||||
|
||||
// Update rate (in ms)
|
||||
unsigned int m_updateRate;
|
||||
|
||||
// Calculated fps.
|
||||
float m_fps;
|
||||
};
|
||||
|
||||
#endif /* SPECTRE_FPS_COUNTER_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue