FPSLimiter

Class for limiting your FPS.

class FPSLimiter {
int _fps;
int _skiphns;
ulong _next;
long _sleep;
}

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.

Examples

1 FPSLimiter limiter = new FPSLimiter(25);
2 while(window.open)
3 {
4    window.clear();
5    // Draw and Update stuff
6    window.display();
7    limiter.wait();
8 }

Meta