#ifndef SPECTRE_FPS_COUNTER_H #define SPECTRE_FPS_COUNTER_H #include // 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 rate); // Update the internal time measurment. bool update(); // Reset the frame time void reset(); private : // Number of frames since last update. unsigned int m_count; // Last time we updated the counter. //Time m_time; Stopwatch m_watch; // Update rate (at what interval should we update) Time m_updateRate; // Calculated Frames per second. float m_fps; }; } // namespace sp #endif /* SPECTRE_FPS_COUNTER_H */