# Khaotic Engine Reborn: fps_limiter Class Reference

Loading...
Searching...
No Matches
fps_limiter Class Reference

## Public Member Functions

| fps_limiter (const float target_fps=60.0f)
bool | should_run ()

## Detailed Description

Definition at line 4 of file fps_limiter.h.

## Constructor & Destructor Documentation

## fps_limiter()

fps_limiter::fps_limiter | ( | const float | target_fps = 60.0f | ) |

inlineexplicit

Definition at line 6 of file fps_limiter.h.

: min_delta_(1.0f / target_fps), last_time_(std::chrono::high_resolution_clock::now()) {}

## Member Function Documentation

## should_run()

bool fps_limiter::should_run | ( |  | ) |

inline

Definition at line 10 of file fps_limiter.h.

{
const auto now = std::chrono::high_resolution_clock::now();
if (const float elapsed = std::chrono::duration<float>(now - last_time_).count(); elapsed >= min_delta_) {
last_time_ = now;
return true;
}
return false;
}

The documentation for this class was generated from the following file:

- enginecustom/src/inc/system/fps_limiter.h