Contains a function that is scheduled to be executed after some time.

Available since

0.1.0

.

Constructor

new(name:String, f:DelayedF ‑> Void, t:Float, once:Bool, frames:Bool)

Creates an nb.Timer.DelayedF instance.

Parameters:

name

A name to identify this instance.

f

The scheduled function. Will have this instance as argument.

t

The time, in seconds, before the associated function gets executed.

once

Whether the associated function is set to be executed only once. If false, the function gets executed every tStart seconds.

frames

If true, t is a number or frames, otherwise it's a time in seconds.

Variables

read onlyframes:Bool

If true, t is a number or frames, otherwise it's a time in seconds.

name:String

A name to identify this instance.

once:Bool

Whether the associated function is set to be executed only once. If false, the function gets executed every tStart seconds.

read onlyt:Float

The time, in seconds, before the associated function gets executed.

tStart:Float

The amount of time in seconds, or number of frames if frames is set to true, after which the function was set to be executed.

f:DelayedF ‑> Void

The scheduled function. Will have this instance as argument.

Methods

tick(dt:Float):Bool

Updates variables and executes the associated function if t <= 0.

Parameters:

dt

The amount of time in seconds elapsed. Ignored if frames is set to true.

Returns:

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