holesome/src/game/frame_counter.hpp

25 lines
437 B
C++

#ifndef HOLESOME_FRAME_COUNTER_HPP
#define HOLESOME_FRAME_COUNTER_HPP
#include <SFML/System/Clock.hpp>
class FrameCounter
{
public:
void reset();
void addFrame();
unsigned int getFps() const;
bool printFpsInConsole = true;
private:
sf::Clock clock;
sf::Time timeSinceLastFpsUpdate = sf::Time::Zero;
unsigned int liveFrameCount = 0;
unsigned int lastFps = 0;
};
#endif //HOLESOME_FRAME_COUNTER_HPP