#ifndef SPECTRE_FPS_COUNTER_H #define SPECTRE_FPS_COUNTER_H // Simple FPS counter. namespace sp { 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; }; } // namespace sp #endif /* SPECTRE_FPS_COUNTER_H */