Class pulse.Scene

Extends pulse.Node.
scene class
Defined in: /src\scene.js

Class Summary
Constructor Attributes Constructor Name and Description
 
pulse.Scene(params)
copyright 2012 ModulusScenes are collections of layers that the basis of allthings visual in the engine.
Field Summary
Field Attributes Field Name and Description
 
Whether this scene is active.
 
HTML element container for this scene, will hold the canvas element.
 
The event manager for this scene, handles all events.
 
Associative array (object) of the layers for this scene.
Fields borrowed from class pulse.Node:
name, parent
Method Summary
Method Attributes Method Name and Description
 
addLayer(layer, zindex)
Adds a new layer to this scene.
 
draw()
Draws any layers that are live and have been updated.
 
eventsCallback(type, evt)
Handles all events sent to this scene.
 
getLayer(name)
Gets a layer from this scene by name.
 
Gets a live canvas for the layer passed in.
 
Gets a live canvas for a layer in this scene.
 
Gets the container for this scene, a DOM div element.
 
on(type, callback)
Convenience function that will bind a callback to an event type.
 
Removes a layer from this scene by name.
 
setDefaultSize(width, height)
Changes the default size of the scene.
 
update(elapsed)
Updates the layers.
 
Updates the scene's container with correctly ordered live canvases.
Event Summary
Event Attributes Event Name and Description
 
click(evt)
Event rose when mouse button is clicked while this scene is active.
 
keydown(evt)
Event rose when a key is pushed down while this scene is active.
 
keypress(evt)
Event rose when a key is pressed while this scene is active.
 
keyup(evt)
Event rose when a key is released while this scene is active.
 
mousedown(evt)
Event rose when mouse button is pressed down while this scene is active.
 
mousemove(evt)
Event rose when mouse is moved while this scene is active.
 
mouseup(evt)
Event rose when mouse button is released while this scene is active.
 
Event rose when mouse wheel is scrolled while this scene is active.
 
touchend(evt)
Event rose when the user releases their touch on the node.
 
touchmove(evt)
Event rose when the user scrolls while tapping on the node.
 
Event rose when the user presses down on the node.
Class Detail
pulse.Scene(params)
copyright 2012 ModulusScenes are collections of layers that the basis of allthings visual in the engine.
Parameters:
{object} params Optional
parameters that can be set as initialized optionson the node
{string} params.name Optional
name of the node
Field Detail
active
Whether this scene is active.

container
HTML element container for this scene, will hold the canvas element.

events
The event manager for this scene, handles all events.

layers
Associative array (object) of the layers for this scene.
Method Detail
addLayer(layer, zindex)
Adds a new layer to this scene.
Parameters:
{pulse.Layer} layer
to add
{number} zindex
the zindex of the new layer

draw()
Draws any layers that are live and have been updated.

eventsCallback(type, evt)
Handles all events sent to this scene. It will check to see if any of theevents occur inside of one of it's layers and if so then passes the eventto that layer.
Parameters:
{string} type
the type of event raised
{object} evt
the event object with properties on the event

getLayer(name)
Gets a layer from this scene by name.
Parameters:
{string} name
the name of the layer to get

getLiveCanvas(layer)
Gets a live canvas for the layer passed in.
Parameters:
{string} layer
the layer to create the canvas/context for

getLiveLayer(name)
Gets a live canvas for a layer in this scene.
Parameters:
{string} name
the name of the layer

{DOMElement} getSceneContainer()
Gets the container for this scene, a DOM div element.
Returns:
{DOMElement} returns the div container for this scene

on(type, callback)
Convenience function that will bind a callback to an event type.
Parameters:
{string} type
the event type to bind
{function} callback
the function callback to bind to the event

removeLayer(name)
Removes a layer from this scene by name.
Parameters:
{string} name
the name of the layer to remove

setDefaultSize(width, height)
Changes the default size of the scene. This will update all thedefault layers sizes too.
Parameters:
{number} width
the new default width
{number} height
the new default height

update(elapsed)
Updates the layers.
Parameters:
{number} elapsed
time elapsed since last update call inmilliseconds

updateLiveLayers()
Updates the scene's container with correctly ordered live canvases.
Event Detail
click(evt)
Event rose when mouse button is clicked while this scene is active.
Parameters:
{pulse.MouseEvent} evt
The mouse event.

keydown(evt)
Event rose when a key is pushed down while this scene is active.
Parameters:
{pulse.Event} evt
The keyboard event.

keypress(evt)
Event rose when a key is pressed while this scene is active.
Parameters:
{pulse.Event} evt
The keyboard event.

keyup(evt)
Event rose when a key is released while this scene is active.
Parameters:
{pulse.Event} evt
The keyboard event.

mousedown(evt)
Event rose when mouse button is pressed down while this scene is active.
Parameters:
{pulse.MouseEvent} evt
The mouse event.

mousemove(evt)
Event rose when mouse is moved while this scene is active.
Parameters:
{pulse.MouseEvent} evt
The mouse event.

mouseup(evt)
Event rose when mouse button is released while this scene is active.
Parameters:
{pulse.MouseEvent} evt
The mouse event.

mousewheel(evt)
Event rose when mouse wheel is scrolled while this scene is active.
Parameters:
{pulse.MouseEvent} evt
The mouse event.

touchend(evt)
Event rose when the user releases their touch on the node.
Parameters:
{pulse.TouchEvent} evt
The touch event for dropped node.

touchmove(evt)
Event rose when the user scrolls while tapping on the node.
Parameters:
{pulse.TouchEvent} evt
The touch event for dropped node.

touchstart(evt)
Event rose when the user presses down on the node.
Parameters:
{pulse.TouchEvent} evt
The touch event for dropped node.