Class Index | File Index

Classes


Class Scene

A Scene represents the root level of content within a Stage.
Defined in: Scene.js.

var myScene = Scene({
   name: "MyScene",
   content: [
      Graphic({url: "./images/ball.png"})
   ]
});
Class Summary
Constructor Attributes Constructor Name and Description
 
Scene(_details)
Method Summary
Method Attributes Method Name and Description
 
addContent(SceneContent)
Adds the given SceneContent to this Scene.
 
draw(_context)
Calls draw on each child content with the given canvas context.
 
extend(_child)
This extends the provided child function with this instance.
 
Uses Stage.getSize() to retrieve the size of the stage, and returns a Bounds({x: 0, y: 0, w: stage_size.w, h: stage_size.h}).
 
Always returns null.
 
Returns a reference to itself.
 
Gets the Stage this scene belongs to.
 
load(Stage)
Loads this Scene in the given Stage.
 
loadContent(Stage)
Loads this Scene's content in the given Stage.
 
moveBy(_distance)
Scene's can't be moved.
 
moveTo(_point)
Scene's can't be moved.
 
update(_runtime)
Updates this Scene with the time since the Stage loaded.
 
updateContent(_runtime)
Updates this Scene's content with the time since the Stage loaded.
Class Detail
Scene(_details)
Parameters:
{Object} _details
A JSON object with the following properties:
Property Required Default
content no new Array()
name no ""
Properties: name: The name of this Scene. content: The content of this Scene.
Method Detail
addContent(SceneContent)
Adds the given SceneContent to this Scene. This function calls the load function on the given SceneContent before adding it to the Scene's content list, so that it will be loaded before getting picked up by the Stage's fun loop.
Parameters:
SceneContent
_content The SceneContent to be added to this Scene.

draw(_context)
Calls draw on each child content with the given canvas context.
Parameters:
_context
The drawing context from the Stage's canvas element.

extend(_child)
This extends the provided child function with this instance.
Parameters:
_child
The child function to be extended.

getBounds()
Uses Stage.getSize() to retrieve the size of the stage, and returns a Bounds({x: 0, y: 0, w: stage_size.w, h: stage_size.h}).
Returns:
Bounds({x: 0, y: 0, w: stage_size.w, h: stage_size.h})

getParent()
Always returns null. The Scene always represents the root level of content within a Stage.
Returns:
null

getScene()
Returns a reference to itself.
Returns:
A reference to this Scene.

getStage()
Gets the Stage this scene belongs to.
Returns:
Stage object this scene belongs to.

load(Stage)
Loads this Scene in the given Stage. This function loops through the Scene content and calls load on each component, passing a reference to this Scene.
Parameters:
Stage
_stage The Stage this scene belongs to.

loadContent(Stage)
Loads this Scene's content in the given Stage. This function loops through the Scene content and calls load on each component, passing a reference to this Scene.
Parameters:
Stage
_stage The Stage this scene belongs to.

moveBy(_distance)
Scene's can't be moved. This method does nothing.
Parameters:
_distance

moveTo(_point)
Scene's can't be moved. This method does nothing.
Parameters:
_point

update(_runtime)
Updates this Scene with the time since the Stage loaded. This function loops through the Scene content and calls the update method on each component.
Parameters:
_runtime
The time since the Stage was loaded.

updateContent(_runtime)
Updates this Scene's content with the time since the Stage loaded. This function loops through the Scene content and calls the update method on each component.
Parameters:
_runtime
The time since the Stage was loaded.

Documentation generated by JsDoc Toolkit 2.3.0 on Fri Oct 30 2009 09:09:10 GMT-0700 (PDT)