#include <iostream>
#include <chrono>

class FPSCounter {
public:
    FPSCounter() : frameCount(0), lastTime(std::chrono::high_resolution_clock::now()) {}

    void update() {
        frameCount++;
        auto currentTime = std::chrono::high_resolution_clock::now();
        std::chrono::duration<double> elapsed = currentTime - lastTime;

        // Aktualizujemy FPS co 1 sekundê
        if (elapsed.count() >= 1.0) {
            double fps = frameCount / elapsed.count();
            std::cout << "FPS: " << fps << std::endl;
            frameCount = 0;
            lastTime = currentTime;
        }
    }

private:
    int frameCount;
    std::chrono::time_point<std::chrono::high_resolution_clock> lastTime;
};
