Patch - Doc Update - V12.8.1
This commit is contained in:
@@ -3,10 +3,19 @@
|
||||
|
||||
class fps_limiter {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Builder for fps_limiter class
|
||||
* This class is used to limit the execution rate of a loop based on a target frames per second (FPS).
|
||||
* @param target_fps Target frames per second for the limiter. The default is 60.0f FPS.
|
||||
*/
|
||||
explicit fps_limiter(const float target_fps = 60.0f)
|
||||
: min_delta_(1.0f / target_fps), last_time_(std::chrono::high_resolution_clock::now()) {}
|
||||
|
||||
// Retourne true si la fonction peut etre executee
|
||||
/**
|
||||
* Function to check if enough time has passed since the last execution.
|
||||
* @return True if the time since the last call is greater than or equal to the minimum delta time, otherwise false.
|
||||
*/
|
||||
bool should_run() {
|
||||
const auto now = std::chrono::high_resolution_clock::now();
|
||||
if (const float elapsed = std::chrono::duration<float>(now - last_time_).count(); elapsed >= min_delta_) {
|
||||
|
||||
Reference in New Issue
Block a user