This file contains the class FPS that contains two function for calculation of the frame rate.
#ifndef FPS_HPP__INCLUDED #define FPS_HPP__INCLUDED #pragma once class FPS { unsigned int m_frame; unsigned int m_fps; sf::Clock m_clock; public: FPS() : m_frame(0), m_fps(0) {} public: void Update(); const unsigned int GetFPS() const { return m_fps; } }; void FPS::Update() { if (m_clock.GetElapsedTime() >= 1.f) { m_fps = m_frame; m_frame = 0; m_clock.Reset(); } ++m_frame; } #endif // FPS_HPP__INCLUDED