Contains a function that is to be executed every frame.

Available since

0.1.0

.

Constructor

new(name:String, f:UpdateF ‑> Void, endCondition:() ‑> Bool)

Creates an nb.Timer.UpdateF instance.

Parameters:

name

A name to identify the instance.

f

The function to be executed every frame. Will have the instance as argument.

endCondition

When this function returns true, f stops being executed.

Variables

name:String

A name to identify this instance.

read onlytElapsed:Float

The amount of time elapsed, in seconds.

read onlytFrames:Int

The amount of frames elapsed.

endCondition:() ‑> Bool

When this function returns true, f stops being executed.

f:UpdateF ‑> Void

The function to be executed every frame. Will have this instance as argument.

Methods

tick(dt:Float):Bool

Updates variables and executes the associated function.

Parameters:

dt

An amount of time in seconds elapsed.

Returns:

true if this instance should cease to be executed, false otherwise.