Scene

new Scene(ctx, width, height)

The scene includes the actors and call their update and render methods.
Parameters:
NameTypeDescription
ctx*context of the canvas
widthnumberwidth of the canvas
heightnumberheight of the canvas

Methods

DOMOffset(el) → {object}

Get DOM offset from given element.
Parameters:
NameTypeDescription
elObjectHTML DOM element
Returns:
- x and y position
Type: 
object

addActor(actor)

Add an actor to the scene.
Parameters:
NameTypeDescription
actorObject

getIdInScene(id)

Get object to id from scene.
Parameters:
NameTypeDescription
idstring

getObjectsInScene(obj)

Get objects based on the obj constructor.
Parameters:
NameTypeDescription
objstring

purge()

Empty the scene with setting and empty list as actors.

removeActor(actor)

Remove an actor from the scene.
Parameters:
NameTypeDescription
actorObject

render(dt)

It renders first the binding and then the rest for a better visual effect.
Parameters:
NameTypeDescription
dtnumber

update(dt)

Iterates over the actors and call their update method.
Parameters:
NameTypeDescription
dtnumber