#ifndef SRC_TIMERS_H_ #define SRC_TIMERS_H_ // General includes #include // GL includes #if _WIN32 #include #else #include #endif // Custom includes #include std::chrono::high_resolution_clock timer; auto FPSCalculateLast = timer.now(); auto FPSClock = SDL_GetTicks(); auto UpdateClock = SDL_GetTicks(); void FPSCount(Logger& logger) { if (SDL_GetTicks() - FPSClock >= 1000) { auto deltaTime = std::chrono::duration_cast(timer.now() - FPSCalculateLast).count(); logger << LOGGER_INFO << "FPS: " << (int)(1 / ((float)deltaTime * 1e-9)) << LOGGER_ENDL; FPSClock = SDL_GetTicks(); } FPSCalculateLast = timer.now(); } bool UPSTimer() { return (SDL_GetTicks() - UpdateClock >= 10); } #endif