|
nngn
|
Simulates a v-sync pause using sleep.
More...
#include <limit.h>
Public Member Functions | |
| int | interval (void) const |
| void | set_interval (int i) |
| void | limit (void) |
| Sleeps for as long as necessary to maintain a constant frame rate. | |
Private Types | |
| using | time_point = nngn::Timing::time_point |
| using | clock = nngn::Timing::clock |
| using | duration = nngn::Timing::duration |
Private Attributes | |
| int | m_interval = 1 |
| time_point | last = clock::now() |
Simulates a v-sync pause using sleep.
limit should be called once at the end of each frame. A constant rate of 60FPS, scaled by the inverse of interval, is maintained no matter the duration between each call to limit.
If one cycle takes too long, limit returns immediately a number of times necessary to generate the correct amount of frames as if the rate had been maintained (i.e. frames are not skipped).
|
private |
|
private |
|
private |
|
inline |

| void nngn::FrameLimiter::limit | ( | void | ) |
Sleeps for as long as necessary to maintain a constant frame rate.


|
inline |
|
private |
|
private |