-
Notifications
You must be signed in to change notification settings - Fork 0
Engine.CustomLoop.API
Engine. CustomLoop
A loop class. Contains a list of functions to run each time the loop executes. For the loop to be executed, it will have to be added to the current room via the Engine.currentRoom.addLoop. A loop also has it's own time that is stopped whenever the loop is not executed. This makes it possible to schedule a function execution that will be "postponed" if the loop gets paused.
Name | Type | Argument | Default | Description |
---|---|---|---|---|
framesPerExecution |
number |
<optional> |
1 | The number of frames between each execution of the custom loop |
maskFunction |
function |
<optional> |
function(){} | A function that will be run before each execution, if the function returns true the execution proceeds as planned, if not, the execution will not be run |
- Source:
Name | Type | Description |
---|---|---|
framesPerExecution |
number | The number of frames between each execution of the custom loop |
maskFunction |
function | A function that will be run before each execution, if the function returns true the execution proceeds as planned, if not, the execution will not be run |
time |
number | The "local" time of the loop. The loop's time is stopped when the loop is not executed. |
execTime |
number | The time it took to perform the last execution |
-
Adds a new animation to the animator class (done automatically when running the animate-function).
Name Type Description animation
object An animation object
- Source:
-
Adds the current executions queue to the list of planned executions. Automatically called at the end of each frame
- Source:
-
Queues a function for being added to the executed functions. The queue works as a buffer which prevent functions, that have just been added, from being executed before the next frame.
- Source:
-
Attaches a function to the loop.
Name Type Description caller
Object The object to run the function as
func
function The function to run on each execution of the custom loop
- Source:
-
Detaches a function from the loop. If the same function is attached multiple times (which is never a good idea), only the first occurrence is detached.
Name Type Description caller
Object The object the function was run as
func
function The function to detach from the loop
- Source:
Whether or not the function was found and detached
- Type
- boolean
-
Detaches all attached functions with a specific caller
Name Type Description caller
Object The object the function was run as
- Source:
An array of detached functions
- Type
- function[]
-
Detaches all occurrences of a specific function, no matter the caller.
Name Type Description func
function The function to detach from the loop
- Source:
An array of detached functions
- Type
- function[]
-
Executes the custom loop. This will execute all the functions that have been added to the loop, and checks all scheduled executions to see if they should fire. This function will automatically be executed, if the loop has been added to the current room, or the engine's masterRoom
- Source:
-
Stop all animations of a specific object from the loop
Name Type Description object
Mixin.Animatable The object to stop all animations of
- Source:
-
Schedules a function to be run after a given amount of time in the loop. If the loop is paused before the execution has happened, the loop's time will stand still, and therefore the scheduled execution will not happen until the loop is started again.
Name Type Description caller
Object The object with which to run the function (by default the custom loop itself)
func
function The function to execute
delay
number The delay in ms
- Source:
-
Unschedules a single scheduled execution. If multiple similar executions exists, only the first will be unscheduled.
Name Type Description func
function The function to unschedule an execution of
caller
Object The object with which the function was to be executed (by default the custom loop itself)
- Source:
Whether or not the function was found and unscheduled
- Type
- boolean
-
Unschedules all scheduled executions
- Source:
An array of all the unscheduled functions
- Type
- function[]
-
Unschedule all executions scheduled with a specific caller
Name Type Description caller
object The caller
- Source:
False if no functions has been unscheduled, otherwise an array containing the unscheduled functions
- Type
- boolean | Array.<function()>
-
Unschedule all scheduled executions of a specific function, no matter the caller.
Name Type Description func
function The function to unschedule all executions of
- Source:
False if no functions has been unscheduled, otherwise an array containing the unscheduled functions
- Type
- boolean | Array.<function()>
-
Update the loop's animations in a single loop (called by updateAllLoops)
- Source:
Generated with wicked.
- Engine.Camera
- Engine.CustomLoop
- Engine.Loader
- Engine.Room
- Engine
- Input.Keyboard
- Input.Pointer
- Math.Circle
- Math.Line
- Math.Polygon
- Math.Rectangle
- Math.Vector
- Sound.Effect
- Sound.Music
- View.Child
- View.Circle
- View.Collidable
- View.Container
- View.GameObject
- View.Line
- View.Polygon
- View.Rectangle
- View.Sprite
- View.TextBlock
- global