A class to schedule tasks.

Available since

0.1.0

.

Static variables

@:value([])staticfinalread onlyconditionalFs:Array<ConditionalF> = []

All active nb.Timer.ConditionalF instances.

@:value([])staticfinalread onlydelayedFs:Array<DelayedF> = []

All active nb.Timer.DelayedF instances.

@:value([])staticfinalread onlydelayedThreads:Array<DelayedF> = []

All active nb.Timer.DelayedF instances.

@:value([])staticfinalread onlyupdateFs:Array<UpdateF> = []

All active nb.Timer.UpdateF instances.

Static methods

@:value({ name : "", once : true })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 true, f gets executed.

once

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

name

A name to identify the instance.

Returns:

The nb.Timer.ConditionalF instance created.

@:value({ name : "", frames : false, once : true })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 false, the function gets executed every tStart seconds.

frames

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

Returns:

The nb.Timer.DelayedF instance created.

@:value({ name : "", frames : true, once : true, t : 1 })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 false, the function gets executed every tStart seconds.

frames

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

Returns:

The nb.Timer.DelayedF instance created.

@:value({ name : "" })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 true, f stops being executed.

name

A name to identify the instance.

Returns:

The nb.Timer.UpdateF instance created.

staticthreadUpdate(dt:Float):Void

delayedThreads functions gets updated here.

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.