API Documentation for: 0.11.8
Show:

platypus.components.HandlerRender Class

A component that handles updating the render components on entities that are rendering via PIXI. Calls 'handle-render on children entities every tick. Also initializes handlers for mouse events on the layer level.

Methods

'child-entity-added'

(
  • entity
)

Called when a new entity has been added to the parent and should be considered for addition to the handler. Entities are sent a reference the Container that we're rendering to, so they can add their display objects to it and the delta from the lastest tick.

Parameters:

'load'

()

Defined in 'load':78

Once the entity is loaded, this component triggers "render-world" to notify other components about the entities' display container.

'pause-render'

(
  • [data]
)

Defined in 'pause-render':121

Pauses the children of this render Container. If a pause time is not provided. It remains paused until 'unpause-render' is called.

Parameters:

'tick'

(
  • tick
)

Defined in 'tick':163

Sends a 'handle-render' message to all the children in the Container. The children in the Container are also paused/unpaused if needed and sorted according to their z value.

Parameters:

  • tick Object

    An object containing tick data.

'unpause-render'

()

Unpauses the children of this render Container.

addEventListener

(
  • event
  • callback
)
Function private
This method adds an event listener to the entity.

Parameters:

  • event String
    The event that this component should listen for.
  • callback Function
    The handler for the event.

Returns:

Function: handler A reference to the bound handler.

addMethod

(
  • name
  • func
)
private
This method adds a method to the entity.

Parameters:

  • name String
    The name of the method. For example, if name is "turnYellow", the method is accessible on the entity as entity.turnYellow().
  • func Function
    The function describing the method.

destroy

() private

Inherited from platypus.Component: destroy:54

This method cleans up listeners and methods that this component added to the entity. It should never be called by the component itself. Call this.owner.removeComponent(this) instead.

getAssetList

(
  • definition
  • properties
  • defaultProperties
)
Array
This method can be overwritten to provide the list of assets this component requires. This method is invoked when the list of game scenes is created to determine assets for each scene.

Parameters:

  • definition Object
    The definition for the component.
  • properties Object
    The properties of the Entity.
  • defaultProperties Object
    The default properties of the Entity.

Returns:

Array: A list of the necessary assets to load.

getLateAssetList

(
  • data
)
Array
This method can be overwritten to provide the list of assets this component requires. This method is invoked when the list of game scenes is created to determine assets for each scene.

Parameters:

  • data Object
    Scene data that affects the list of assets.

Returns:

Array: A list of the necessary assets to load.

removeEventListener

(
  • event
  • callback
)
private
This method removes an event listener from the entity.

Parameters:

  • event String
    The event for which to remove a listener.
  • callback Function
    The listener to remove. If not supplied, all event listeners for the provided event are removed.

removeEventListeners

(
  • [listeners]
)
private
This method removes multiple event listeners from the entity.

Parameters:

  • [listeners] Array optional
    The list of listeners to remove. If not supplied, all event listeners are removed.

removeMethod

(
  • name
)
private
This method removes a method from the entity.

Parameters:

  • name String
    The name of the method to be removed.

toJSON

() Object

Inherited from platypus.Component: toJSON:45

Available since 0.11.0

Returns a JSON object describing the component.

Returns:

Object: Returns a JSON definition that can be used to recreate the component.

toString

() String
Returns a string describing the component.

Returns:

String: Returns the component type as a string of the form "[Component ComponentType]".

Properties

interactive

Boolean | Object

Defined in interactive:21

Available since 0.9.1

Defines whether the entity will respond to touch and click events. Setting this value will create an Interactive component on this entity with these properties. For example:

"interactive": { "hover": false, "hitArea": { "x": 10, "y": 10, "width": 40, "height": 40 } }

Default: false

worldContainer

PIXI.Container

Defined in worldContainer:44

Available since 0.11.0

This is the container holding all children's disply objects for this layer. It's an available proeprty on the layer entity.

Default: null

Events

'handle-render'

Defined in 'handle-render':188

Triggered every tick on the children entities.

Event Payload:

  • data Object
    • delta Number

      The delta time for this tick.

    • container PIXI.Container

      The display Container the entities display objects should be added to.

'handle-render-load'

Triggered on an entity added to the parent.

Event Payload:

  • data Object
    • delta Number

      The delta time for this tick.

    • container PIXI.Container

      The display Container the entities display objects should be added to.

'input-on'

Defined in 'input-on':95

This event is triggered once HandlerRender is ready to handle interactivity.

'render-paused'

Defined in 'render-paused':135

Available since 0.8.4

Notifies children entities that rendering updates have been paused.

'render-unpaused'

Defined in 'render-unpaused':153

Available since 0.8.4

Notifies children entities that rendering updates have been unpaused.

'render-world'

Defined in 'render-world':84

Once the entity is loaded, this component triggers "render-world" to notify other components about the entities' display container.

Event Payload:

  • data Object
    • world PIXI.Container

      Contains entities to be rendered.