class Timer
package nb
A class to schedule tasks.
0.1.0
.Static variables
staticfinalread onlyconditionalFs:Array<ConditionalF> = []
All active nb.Timer.ConditionalF
instances.
Static methods
staticaddConditionalF(f:ConditionalF ‑> Void, condition:() ‑> Bool, once:Bool = true, name:String = ""):ConditionalF
Creates and adds a new nb.Timer.ConditionalF
instance.
Parameters:
f | The scheduled function. Will have this instance as argument. |
---|---|
condition | When this function returns |
once | Whether the associated function is set to be executed only once.
If |
name | A name to identify the instance. |
Returns:
The nb.Timer.ConditionalF
instance created.
staticaddDelayedF(f:DelayedF ‑> Void, t:Float, once:Bool = true, frames:Bool = false, name:String = ""):DelayedF
Creates and adds a new nb.Timer.DelayedF
instance.
Parameters:
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 |
frames | If |
Returns:
The nb.Timer.DelayedF
instance created.
staticaddDelayedThread(f:DelayedF ‑> Void, t:Float = 1, once:Bool = true, frames:Bool = true, name:String = ""):DelayedF
Creates and adds a new nb.Timer.DelayedF
instance that is delayed by
enough time to ensure that it gets executed when the driver is ready.
Parameters:
f | The scheduled function. |
---|---|
t | The time, in seconds, before the associated function gets executed. |
once | Whether the associated function is set to be executed only once.
If |
frames | If |
Returns:
The nb.Timer.DelayedF
instance created.
staticaddUpdateF(f:UpdateF ‑> Void, ?endCondition:() ‑> Bool, name:String = ""):UpdateF
Creates and adds a new nb.Timer.UpdateF
instance.
Parameters:
f | The scheduled function. Will have the instance as argument. |
---|---|
endCondition | When this function returns |
name | A name to identify the instance. |
Returns:
The nb.Timer.UpdateF
instance created.
staticupdate(dt:Float):Void
The update function that gets called by nb.Manager
.
All active functions gets updated here, except for delayedThreads
, which gets
updated in the threadUpdate
function.