LoopManager

class LoopManager(targetFPS: Int, val updateFunction: (deltaTime: Long) -> Unit, val renderFunction: () -> Unit)

Manages the main loop for updating and rendering at a target frames per second (FPS).

Parameters

targetFPS

The target frames per second.

updateFunction

The function to call for updating logic.

renderFunction

The function to call for rendering.

Constructors

Link copied to clipboard
constructor(targetFPS: Int, updateFunction: (deltaTime: Long) -> Unit, renderFunction: () -> Unit)

Properties

Link copied to clipboard
var fps: Double

Frames per second, calculated and updated periodically.

Link copied to clipboard
val renderFunction: () -> Unit
Link copied to clipboard
val updateFunction: (deltaTime: Long) -> Unit

Functions

Link copied to clipboard
fun start()

Starts the loop manager, scheduling the loop at a fixed rate.