Class: Controls

Controls()

Set of controls which affect a view (e.g. keyboard, touch)

ControlMethod instances can be registered on this class. The methods are then combined to calculate the final parameters to change the View.

Controls is attached to a RenderLoop. Currently it affects the view of all Layer on the Stage of the RenderLoop it is attached to. A more flexible API may be provided in the future.

The ControlMethod instances are registered with an id and may be enabled, disabled and unregistered using that id. The whole Control can also be enabled or disabled.

Constructor

new Controls()

Methods

addMethodGroup(groupId, methodIds)

Create a method group, which can be used to more conveniently enable or disable several control methods at once

Parameters:
Name Type Description
groupId String
methodIds Array.<String>

attach(renderLoop)

Attaches the controls to a RenderLoop. The RenderLoop will be woken up when the controls are activated

Parameters:
Name Type Description
renderLoop RenderLoop

attached()

Parameters:
Type Description
Boolean

destroy()

Destroys the instance

detach()

Detaches the controls

disable()

Disables the controls

disableMethod(id)

Parameters:
Name Type Description
id String

disableMethodGroup(groupId)

Disables all the control methods in the group

Parameters:
Name Type Description
groupId String

enable()

Enables the controls

enabled() → {Boolean}

Returns:
Type
Boolean

enableMethod(id)

Parameters:
Name Type Description
id String

enableMethodGroup(groupId)

Enables all the control methods in the group

Parameters:
Name Type Description
groupId String

method(id) → {ControlMethod}

Parameters:
Name Type Description
id String
Returns:
Type
ControlMethod

methodGroups() → {Array.<ControlMethodGroup>}

Returns:

List of control method groups

Type
Array.<ControlMethodGroup>

methods() → {Array.<ControlMethod>}

Returns:

List of registered @{link ControlMethod instances}

Type
Array.<ControlMethod>

registerMethod(id, instance, enableopt)

Parameters:
Name Type Attributes Default Description
id String
instance ControlMethod
enable Boolean <optional>
false

removeMethodGroup(groupId)

Parameters:
Name Type Description
groupId String

unregisterMethod(id)

Parameters:
Name Type Description
id String