Class FPSLimiter¶
Defined in File fps_limiter.hpp
Class Documentation¶
-
class FPSLimiter¶
A wrapper class for counting and limiting frames per second.
Public Functions
-
FPSLimiter(std::uint32_t max_fps = DEFAULT_FPS)¶
-
void set_max_fps(std::uint32_t max_fps)¶
-
bool is_next_frame_allowed()¶
Ask if the next frame is allowed to be rendered.
-
std::optional<std::uint32_t> get_fps()¶
Return the fps every second, std::nullopt otherwise.
Public Static Attributes
-
static constexpr std::uint32_t DEFAULT_FPS = {1000}¶
Private Members
-
std::uint32_t m_max_fps = {DEFAULT_FPS}¶
-
std::chrono::milliseconds m_frame_time = {DEFAULT_FPS / 1000}¶
-
std::chrono::time_point<std::chrono::high_resolution_clock> m_last_time¶
-
std::chrono::time_point<std::chrono::high_resolution_clock> m_last_fps_update_time¶
-
std::chrono::milliseconds m_fps_update_interval = {1000}¶
-
std::uint32_t m_frames = {0}¶
-
FPSLimiter(std::uint32_t max_fps = DEFAULT_FPS)¶