mirror of
https://github.com/Kbz-8/42_vox.git
synced 2026-01-11 14:43:34 +00:00
adding fps display
This commit is contained in:
24
Application/FpsCounter.h
git.filemode.normal_file
24
Application/FpsCounter.h
git.filemode.normal_file
@@ -0,0 +1,24 @@
|
||||
#ifndef FPS_COUNTER_H
|
||||
#define FPS_COUNTER_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <chrono>
|
||||
|
||||
class FpsCounter
|
||||
{
|
||||
public:
|
||||
FpsCounter();
|
||||
|
||||
void Update();
|
||||
[[nodiscard]] inline std::uint32_t GetFPSCount() const noexcept { return m_current_fps; }
|
||||
|
||||
~FpsCounter() = default;
|
||||
|
||||
private:
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> m_now;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> m_past;
|
||||
std::uint32_t m_counter = 0;
|
||||
std::uint32_t m_current_fps = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user