FPSLimiter

Class for limiting your FPS.

Constructors

this
this(int maxFPS)

Creates a new FPS Limiter instance with specified max FPS.

Members

Functions

wait
void wait()

Calculates how long to wait and then waits that amount of time to ensure the target FPS.

Variables

_fps
int _fps;
Undocumented in source.
_next
ulong _next;
Undocumented in source.
_skiphns
int _skiphns;
Undocumented in source.
_sleep
long _sleep;
Undocumented in source.

Examples

FPSLimiter limiter = new FPSLimiter(25);
while(window.open)
{
    window.clear();
    // Draw and Update stuff
    window.display();
    limiter.wait();
}

Meta