FrameLimiter

class FrameLimiter(    coroutineScope: <Error class: unknown class>,     frameMillis: () -> Long,     impreciseDelay: suspend (Long) -> Unit = ::delay,     currentTime: () -> <Error class: unknown class> = { System.nanoTime().nanoseconds })

Limit the duration of the frames (to avoid high CPU usage) to frameMillis. The actual delay depends on the precision of the system timer (Windows has ~15ms precision by default, Linux/macOs ~2ms). FrameLimiter will try to delay frames as close as possible to frameMillis, but not greater

Constructors

Link copied to clipboard
constructor(    coroutineScope: <Error class: unknown class>,     frameMillis: () -> Long,     impreciseDelay: suspend (Long) -> Unit = ::delay,     currentTime: () -> <Error class: unknown class> = { System.nanoTime().nanoseconds })

Functions

Link copied to clipboard
suspend fun awaitNextFrame()

Await the next frame, if it is not ready yet (the previous awaitNextFrame was called less than frameMillis ago)