Class Index | File Index

Classes


Class CAAT.Foundation.Director


Extends CAAT.Foundation.ActorContainer.

Defined in: Director.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
<private>  
Calculated gesture event rotation.
<private>  
Calculated gesture event scale.
<private>  
this director´s audio manager.
 
Some browser related information.
<private>  
The canvas the Director draws on.
<private>  
current dirty rects.
 
Clear screen strategy: CAAT.Foundation.Director.CLEAR_NONE : director won´t clear the background.
<static>  
CAAT.Foundation.Director.CLEAR_ALL
<static>  
CAAT.Foundation.Director.CLEAR_DIRTY_RECTS
<static>  
CAAT.Foundation.Director.CLEAR_NONE
<private>  
webGL vertex array
<private>  
webGL vertex indices.
 
ctx
This director´s canvas rendering context.
<private>  
webGL current shader opacity.
 
The current Scene.
<private>  
webGL current texture page.
 
flag indicating debug mode.
<private>  
Dirty rects cache.
<private>  
Dirty rects enabled ??
<private>  
Number of currently allocated dirty rects.
 
is input in drag mode ?
<private>  
Dirty rects count debug info.
 
Rendered frames counter.
<private>  
draw tris front_to_back or back_to_front ?
<private>  
gl
3d context
<private>  
is WebGL enabled as renderer ?
<private>  
if webGL is on, CAAT will texture pack all images transparently.
<private>  
The only GLSL program for webGL
 
An array of JSON elements of the form { id:string, image:Image }
<private>  
if CAAT.NO_RAF is set (no request animation frame), this value is the setInterval returned id.
 
is the left mouse button pressed ?.
 
director's last actor receiving input.
<private>  
mouse coordinate related to canvas 0,0 coord.
<private>  
Number of dirty rects.
<private>  
currently unused.
<private>  
This method will be called after rendering any director scene.
<private>  
This method will be called before rendering any director scene.
 
Callback when the window is resized.
<private>  
webGL projection matrix
<private>  
previous mouse position cache.
<static>  
CAAT.Foundation.Director.RENDER_MODE_CONTINUOUS
<static>  
CAAT.Foundation.Director.RENDER_MODE_DIRTY
 
Set CAAT render mode.
<private>  
Window resize strategy.
<static>  
CAAT.Foundation.Director.RESIZE_BOTH
<static>  
CAAT.Foundation.Director.RESIZE_HEIGHT
<static>  
CAAT.Foundation.Director.RESIZE_NONE
<static>  
CAAT.Foundation.Director.RESIZE_PROPORTIONAL
<static>  
CAAT.Foundation.Director.RESIZE_WIDTH
 
This director scene collection.
<private>  
Retina display deicePixels/backingStorePixels ratio
<private>  
screen mouse coordinates.
<private>  
Currently used dirty rects.
 
statistics object
 
Is this director stopped ?
<private>  
director time.
<private>  
global director timeline.
<private>  
Director´s timer manager.
<private>  
Touches information.
<private>  
if CAAT.CACHE_SCENE_ON_CHANGE is set, this scene will hold a cached copy of the exiting scene.
<private>  
uv
webGL uv texture indices
Fields borrowed from class CAAT.Foundation.ActorContainer:
activeChildren, addHint, boundingBox, childrenList, layoutInvalidated, layoutManager, pendingChildrenList, runion
Fields borrowed from class CAAT.Foundation.Actor:
__super, AABB, alpha, backgroundImage, behaviorList, cached, clip, clipPath, dirty, discardable, duration, expired, fillStyle, frameAlpha, gestureEnabled, height, id, inFrame, invalid, isAA, isCachedActor, isGlobalAlpha, lifecycleListenerList, minimumSize, modelViewMatrix, modelViewMatrixI, mouseEnabled, oldX, oldY, parent, pointed, preferredSize, preventLayout, rotationAngle, rotationX, rotationY, scaleAnchor, scaleTX, scaleTY, scaleX, scaleY, size_active, size_total, start_time, strokeStyle, tAnchorX, tAnchorY, viewVertices, visible, wdirty, width, worldModelViewMatrix, worldModelViewMatrixI, x, y
Method Summary
Method Attributes Method Name and Description
<private>  
<private>  
__gestureChange(scale, rotation)
<private>  
__gestureEnd(scale, rotation)
<private>  
__gestureStart(scale, rotation)
<private>  
<private>  
<private>  
<private>  
<private>  
<private>  
<private>  
<private>  
<private>  
<private>  
<private>  
<private>  
<private>  
<private>  
<private>  
<private>  
<private>  
Same as mouseDown but not preventing event.
<private>  
 
addAudio(id, url)
Adds an audio to the cache.
 
addChild(scene)
Adds an scene to this Director.
 
addDirtyRect(rectangle)
Add a rectangle to the list of dirty screen areas which should be redrawn.
 
addHandlers(canvas)
 
addImage(id, image, noUpdateGL)
Add a new image to director's image cache.
 
addScene(scene)
Add a new Scene to Director's Scene list.
 
animate(director, time)
A director is a very special kind of actor.
 
Loops an audio instance identified by the id.
 
Plays the audio instance identified by the id.
 
 
cancelPlayByChannel(audioObject)
 
 
 
 
Creates an initializes a Scene object.
 
createTimer(startTime, duration, callback_timeout, callback_tick, callback_cancel)
 
cumulateOffset(node, parent, prop)
Acculumate dom elements position to properly offset on-screen mouse/touch events.
 
deleteImage(id, noUpdateGL)
 
easeEnd(scene, b_easeIn)
Scene easing listener.
 
easeIn(inSceneIndex, type, time, alpha, anchor, interpolator)
This method changes Director's current Scene to the scene index indicated by inSceneIndex parameter.
 
easeInOut(inSceneIndex, typein, anchorin, outSceneIndex, typeout, anchorout, time, alpha, interpolatorIn, interpolatorOut)
This method offers full control over the process of switching between any given two Scenes.
 
easeInOutRandom(inIndex, outIndex, time, alpha)
This method will switch between two given Scene indexes (ie, take away scene number 2, and bring in scene number 5).
 
Removes Director's scenes.
 
enableEvents(onElement)
 
enableResizeEvents(mode, onResizeCallback)
Enable window resize events and set redimension policy.
 
 
 
 
Get this Director's AudioManager instance.
 
Return the running browser name.
 
Return the running browser version.
 
getCanvasCoord(point, e)
Normalize input event coordinates to be related to (0,0) canvas position.
 
 
Return the index of the current scene in the Director's scene list.
 
getImage(sId)
Gets the resource with the specified resource name.
 
Get the number of scenes contained in the Director.
 
getOffset(node)
 
Return the operating system name.
 
 
getScene(index)
Get a concrete director's scene.
 
 
Return the index for a given Scene object contained in the Director.
 
 
 
glRender(vertex, coordsIndex, uv)
Render buffered elements.
 
 
 
initialize(width, height, canvas, proxy)
This method performs Director initialization.
 
initializeGL(width, height, canvas, proxy)
Experimental.
 
 
 
loop(fps, callback, callback2)
 
mouseDown(mouseEvent)
 
mouseDrag(mouseEvent)
 
mouseEnter(mouseEvent)
 
mouseExit(mouseEvent)
 
mouseMove(mouseEvent)
 
mouseUp(mouseEvent)
 
 
 
render(time)
This is the entry point for the animation system of the Director.
 
Starts the director animation.If no scene is explicitly selected, the current Scene will be the first scene added to the Director.
 
renderToContext(ctx, scene)
This method draws an Scene to an offscreen canvas.
 
<private>  
Reset statistics information.
 
If the director has renderingMode: DIRTY, the timeline must be reset to register accurate frame measurement.
 
scheduleDirtyRect(rectangle)
This method is used when asynchronous operations must produce some dirty rectangle painting.
 
 
setBounds(x, y, w, h)
Set this director's bounds as well as its contained scenes.
 
setClear(clear)
This method states whether the director must clear background before rendering each frame.
 
 
 
setImagesCache(imagesCache, tpW, tpH)
 
setMusicEnabled(enabled)
 
 
setScene(sceneIndex)
Changes (or sets) the current Director scene to the index parameter.
 
 
setValueForKey(key, value)
 
setVolume(id, volume)
 
switchToNextScene(time, alpha, transition)
Sets the previous Scene in sequence as the current Scene.
 
switchToPrevScene(time, alpha, transition)
Sets the previous Scene in sequence as the current Scene.
 
switchToScene(iNewSceneIndex, time, alpha, transition)
This method will change the current Scene by the Scene indicated as parameter.
 
 
Methods borrowed from class CAAT.Foundation.ActorContainer:
__paintActor, __validateLayout, __validateTree, addActor, addActorImmediately, addChildAt, addChildDelayed, addChildImmediately, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorById, findChild, getChildAt, getLayout, getNumActiveChildren, getNumChildren, invalidateLayout, paintActor, paintActorGL, recalcSize, removeChild, removeChildAt, removeFirstChild, removeLastChild, setLayout, setZOrder
Methods borrowed from class CAAT.Foundation.Actor:
__scale1To, addAnimation, addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, disableDrag, emptyBehaviorList, enableDrag, fireEvent, gestureChange, gestureEnd, gestureStart, getAnchor, getAnchorPercent, getBehavior, getId, getMinimumSize, getPreferredSize, getTextureGLPage, glNeedsFlush, glSetShader, invalidate, isCached, isGestureEnabled, isInAnimationFrame, isVisible, modelToModel, modelToView, mouseClick, mouseDblClick, mouseOut, mouseOver, moveTo, paint, playAnimation, removeBehaviorById, removeBehaviour, removeListener, resetAnimationTime, resetAsButton, resetTransform, rotateTo, scaleTo, scaleXTo, scaleYTo, setAlpha, setAnimationEndCallback, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setButtonImageIndex, setCachedActor, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setGlobalAnchor, setId, setImageTransformation, setLocation, setMinimumSize, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setPosition, setPositionAnchor, setPositionAnchored, setPreferredSize, setPreventLayout, setRotation, setRotationAnchor, setRotationAnchored, setScale, setScaleAnchor, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, stopCacheAsBitmap, touchEnd, touchMove, touchStart, viewToModel
Class Detail
CAAT.Foundation.Director()
Field Detail
<private> __gestureRotation
Calculated gesture event rotation.

<private> __gestureScale
Calculated gesture event scale.

<private> audioManager
this director´s audio manager.

browserInfo
Some browser related information.

<private> canvas
The canvas the Director draws on.

<private> cDirtyRects
current dirty rects.

clear
Clear screen strategy: CAAT.Foundation.Director.CLEAR_NONE : director won´t clear the background. CAAT.Foundation.Director.CLEAR_DIRTY_RECTS : clear only affected actors screen area. CAAT.Foundation.Director.CLEAR_ALL : clear the whole canvas object.

<static> CAAT.Foundation.Director.CLEAR_ALL

<static> CAAT.Foundation.Director.CLEAR_DIRTY_RECTS

<static> CAAT.Foundation.Director.CLEAR_NONE

<private> coords
webGL vertex array

<private> coordsIndex
webGL vertex indices.

ctx
This director´s canvas rendering context.

<private> currentOpacity
webGL current shader opacity. BUGBUG: change this by vertex colors.

currentScene
The current Scene. This and only this will receive events.

<private> currentTexturePage
webGL current texture page. This minimizes webGL context changes.

debug
flag indicating debug mode. It will draw affedted screen areas.

<private> dirtyRects
Dirty rects cache. An array of CAAT.Math.Rectangle object.

<private> dirtyRectsEnabled
Dirty rects enabled ??

<private> dirtyRectsIndex
Number of currently allocated dirty rects.

dragging
is input in drag mode ?

<private> drDiscarded
Dirty rects count debug info.

frameCounter
Rendered frames counter.

<private> front_to_back
draw tris front_to_back or back_to_front ?

<private> gl
3d context

<private> glEnabled
is WebGL enabled as renderer ?

<private> glTextureManager
if webGL is on, CAAT will texture pack all images transparently.

<private> glTtextureProgram
The only GLSL program for webGL

imagesCache
An array of JSON elements of the form { id:string, image:Image }

<private> intervalId
if CAAT.NO_RAF is set (no request animation frame), this value is the setInterval returned id.

isMouseDown
is the left mouse button pressed ?. Needed to handle dragging.

lastSelectedActor
director's last actor receiving input. Needed to set capture for dragging events.

<private> mousePoint
mouse coordinate related to canvas 0,0 coord.

<private> nDirtyRects
Number of dirty rects.

<private> needsRepaint
currently unused. Intended to run caat in evented mode.

<private> onRenderEnd
This method will be called after rendering any director scene. Use this method to clean your physics forces for example.

<private> onRenderStart
This method will be called before rendering any director scene. Use this method to calculate your physics for example.

onResizeCallback
Callback when the window is resized.

<private> pMatrix
webGL projection matrix

<private> prevMousePoint
previous mouse position cache. Needed for drag events.

<static> CAAT.Foundation.Director.RENDER_MODE_CONTINUOUS

<static> CAAT.Foundation.Director.RENDER_MODE_DIRTY

renderMode
Set CAAT render mode. Right now, this takes no effect.

<private> resize
Window resize strategy. see CAAT.Foundation.Director.RESIZE_* constants.

<static> CAAT.Foundation.Director.RESIZE_BOTH

<static> CAAT.Foundation.Director.RESIZE_HEIGHT

<static> CAAT.Foundation.Director.RESIZE_NONE

<static> CAAT.Foundation.Director.RESIZE_PROPORTIONAL

<static> CAAT.Foundation.Director.RESIZE_WIDTH

scenes
This director scene collection.

<private> SCREEN_RATIO
Retina display deicePixels/backingStorePixels ratio

<private> screenMousePoint
screen mouse coordinates.

<private> sDirtyRects
Currently used dirty rects.

statistics
statistics object

stopped
Is this director stopped ?

<private> time
director time.

<private> timeline
global director timeline.

<private> timerManager
Director´s timer manager. Each scene has a timerManager as well. The difference is the scope. Director´s timers will always be checked whereas scene´ timers will only be scheduled/checked when the scene is director´ current scene.

<private> touches
Touches information. Associate touch.id with an actor and original touch info.

<private> transitionScene
if CAAT.CACHE_SCENE_ON_CHANGE is set, this scene will hold a cached copy of the exiting scene.

<private> uv
webGL uv texture indices
Method Detail
<private> __findTouchFirstActor()

<private> __gestureChange(scale, rotation)
Parameters:
scale
rotation

<private> __gestureEnd(scale, rotation)
Parameters:
scale
rotation

<private> __gestureStart(scale, rotation)
Parameters:
scale
rotation

<private> __init()

<private> __mouseDBLClickHandler(e)
Parameters:
e

<private> __mouseDownHandler(e)
Parameters:
e

<private> __mouseMoveHandler(e)
Parameters:
e

<private> __mouseOutHandler(e)
Parameters:
e

<private> __mouseOverHandler(e)
Parameters:
e

<private> __mouseUpHandler(e)
Parameters:
e

<private> __setupRetina()

<private> __touchCancelHandleMT(e)
Parameters:
e

<private> __touchEndHandler(e)
Parameters:
e

<private> __touchEndHandlerMT(e)
Parameters:
e

<private> __touchGestureChangeHandleMT(e)
Parameters:
e

<private> __touchGestureEndHandleMT(e)
Parameters:
e

<private> __touchGestureStartHandleMT(e)
Parameters:
e

<private> __touchMoveHandler(e)
Parameters:
e

<private> __touchMoveHandlerMT(e)
Parameters:
e

<private> __touchStartHandler(e)
Same as mouseDown but not preventing event. Will only take care of first touch.
Parameters:
e

<private> __touchStartHandlerMT(e)
Parameters:
e

addAudio(id, url)
Adds an audio to the cache.
Parameters:
id
url
Returns:
this
See:
CAAT.Module.Audio.AudioManager.addAudio

addChild(scene)
Adds an scene to this Director.
Parameters:
scene
{CAAT.Foundation.Scene} a scene object.

addDirtyRect(rectangle)
Add a rectangle to the list of dirty screen areas which should be redrawn. This is the opposite method to clear the whole screen and repaint everything again. Despite i'm not very fond of dirty rectangles because it needs some extra calculations, this procedure has shown to be speeding things up under certain situations. Nevertheless it doesn't or even lowers performance under others, so it is a developer choice to activate them via a call to setClear( CAAT.Director.CLEAR_DIRTY_RECTS ). This function, not only tracks a list of dirty rectangles, but tries to optimize the list. Overlapping rectangles will be removed and intersecting ones will be unioned. Before calling this method, check if this.dirtyRectsEnabled is true.
Parameters:
rectangle
{CAAT.Rectangle}

addHandlers(canvas)
Parameters:
canvas

addImage(id, image, noUpdateGL)
Add a new image to director's image cache. If gl is enabled and the 'noUpdateGL' is not set to true this function will try to recreate the whole GL texture pages. If many handcrafted images are to be added to the director, some performance can be achieved by calling director.addImage(id,image,false) many times and a final call with director.addImage(id,image,true) to finally command the director to create texture pages.
Parameters:
id
{string|object} an identitifier to retrieve the image with
image
{Image|HTMLCanvasElement} image to add to cache
noUpdateGL
{!boolean} unless otherwise stated, the director will try to recreate the texture pages.

addScene(scene)
Add a new Scene to Director's Scene list. By adding a Scene to the Director does not mean it will be immediately visible, you should explicitly call either
Parameters:
scene
{CAAT.Foundation.Scene}

animate(director, time)
A director is a very special kind of actor. Its animation routine simple sets its modelViewMatrix in case some transformation's been applied. No behaviors are allowed for Director instances.
Parameters:
director
{CAAT.Director} redundant reference to CAAT.Director itself
time
{number} director time.

{HTMLElement|null} audioLoop(id)
Loops an audio instance identified by the id.
Parameters:
id
{object} the object used to store a sound in the audioCache.
Returns:
{HTMLElement|null} the value from audioManager.loop

audioPlay(id)
Plays the audio instance identified by the id.
Parameters:
id
{object} the object used to store a sound in the audioCache.

cancelPlay(id)
Parameters:
id

cancelPlayByChannel(audioObject)
Parameters:
audioObject

checkDebug()

clean()

createEventHandler()

{CAAT.Scene} createScene()
Creates an initializes a Scene object.
Returns:
{CAAT.Scene}

createTimer(startTime, duration, callback_timeout, callback_tick, callback_cancel)
Parameters:
startTime
duration
callback_timeout
callback_tick
callback_cancel

cumulateOffset(node, parent, prop)
Acculumate dom elements position to properly offset on-screen mouse/touch events.
Parameters:
node
parent
prop

deleteImage(id, noUpdateGL)
Parameters:
id
noUpdateGL

easeEnd(scene, b_easeIn)
Scene easing listener. Notifies scenes when they're about to be activated (set as current director's scene).
Parameters:
scene
{CAAT.Foundation.Scene} the scene that has just been brought in or taken out of the director.
b_easeIn
{boolean} scene enters or exits ?

easeIn(inSceneIndex, type, time, alpha, anchor, interpolator)
This method changes Director's current Scene to the scene index indicated by inSceneIndex parameter. The Scene running in the director won't be eased out.
Parameters:
inSceneIndex
integer indicating the new Scene to set as current.
type
integer indicating the type of transition to apply to bring the new current Scene to the Director. The values will be one of: CAAT.Scene.prototype.EASE_ROTATION, CAAT.Scene.prototype.EASE_SCALE, CAAT.Scene.prototype.EASE_TRANSLATION.
time
integer indicating how much time in milliseconds the Scene entrance will take.
alpha
boolean indicating whether alpha transparency fading will be applied to the entereing Scene.
anchor
integer indicating the anchor to fix for Scene transition. It will be any of CAAT.Actor.prototype.ANCHOR_* values.
interpolator
an CAAT.Interpolator object indicating the interpolation function to apply.
See:

easeInOut(inSceneIndex, typein, anchorin, outSceneIndex, typeout, anchorout, time, alpha, interpolatorIn, interpolatorOut)
This method offers full control over the process of switching between any given two Scenes. To apply this method, you must specify the type of transition to apply for each Scene and the anchor to keep the Scene pinned at.

The type of transition will be one of the following values defined in CAAT.Foundation.Scene.prototype:

The anchor will be any of these values defined in CAAT.Foundation.Actor:

In example, for an entering scene performing a EASE_SCALE transition, the anchor is the point by which the scene will scaled.

Parameters:
inSceneIndex
integer indicating the Scene index to bring in to the Director.
typein
integer indicating the type of transition to apply to the bringing in Scene.
anchorin
integer indicating the anchor of the bringing in Scene.
outSceneIndex
integer indicating the Scene index to take away from the Director.
typeout
integer indicating the type of transition to apply to the taking away in Scene.
anchorout
integer indicating the anchor of the taking away Scene.
time
inteter indicating the time to perform the process of switchihg between Scene object in milliseconds.
alpha
boolean boolean indicating whether alpha transparency fading will be applied to the scenes.
interpolatorIn
CAAT.Behavior.Interpolator object to apply to entering scene.
interpolatorOut
CAAT.Behavior.Interpolator object to apply to exiting scene.

easeInOutRandom(inIndex, outIndex, time, alpha)
This method will switch between two given Scene indexes (ie, take away scene number 2, and bring in scene number 5).

It will randomly choose for each Scene the type of transition to apply and the anchor point of each transition type.

It will also set for different kind of transitions the following interpolators:

These are the default values, and could not be changed by now. This method in final instance delegates the process to easeInOutMethod.

Parameters:
inIndex
integer indicating the entering scene index.
outIndex
integer indicating the exiting scene index.
time
integer indicating the time to take for the process of Scene in/out in milliseconds.
alpha
boolean indicating whether alpha transparency fading should be applied to transitions.
See:
easeInOutMethod.

emptyScenes()
Removes Director's scenes.

enableEvents(onElement)
Parameters:
onElement

enableResizeEvents(mode, onResizeCallback)
Enable window resize events and set redimension policy. A callback functio could be supplied to be notified on a Director redimension event. This is necessary in the case you set a redim policy not equal to RESIZE_PROPORTIONAL. In those redimension modes, director's area and their children scenes are resized to fit the new area. But scenes content is not resized, and have no option of knowing so uless an onResizeCallback function is supplied.
Parameters:
mode
{number} RESIZE_BOTH, RESIZE_WIDTH, RESIZE_HEIGHT, RESIZE_NONE.
onResizeCallback
{function(director{CAAT.Director}, width{integer}, height{integer})} a callback to notify on canvas resize.

endLoop()

endSound()

findActorAtPosition(point)
Parameters:
point

{CAAT.AudioManager} getAudioManager()
Get this Director's AudioManager instance.
Returns:
{CAAT.AudioManager} the AudioManager instance.

{string} getBrowserName()
Return the running browser name.
Returns:
{string} the browser name.

{string} getBrowserVersion()
Return the running browser version.
Returns:
{string} the browser version.

getCanvasCoord(point, e)
Normalize input event coordinates to be related to (0,0) canvas position.
Parameters:
point
{CAAT.Math.Point} canvas coordinate.
e
{MouseEvent} a mouse event from an input event.

getCurrentScene()

{number} getCurrentSceneIndex()
Return the index of the current scene in the Director's scene list.
Returns:
{number} the current scene's index.

getImage(sId)
Gets the resource with the specified resource name. The Director holds a collection called imagesCache where you can store a JSON of the form [ { id: imageId, image: imageObject } ]. This structure will be used as a resources cache. There's a CAAT.Module.ImagePreloader class to preload resources and generate this structure on loading finalization.
Parameters:
sId
{object} an String identifying a resource.

{number} getNumScenes()
Get the number of scenes contained in the Director.
Returns:
{number} the number of scenes contained in the Director.

getOffset(node)
Parameters:
node

{string} getOSName()
Return the operating system name.
Returns:
{string} the os name.

getRenderType()

{CAAT.Foundation.Scene} getScene(index)
Get a concrete director's scene.
Parameters:
index
{number} an integer indicating the scene index.
Returns:
{CAAT.Foundation.Scene} a CAAT.Scene object instance or null if the index is oob.

getSceneById(id)
Parameters:
id

getSceneIndex(scene)
Return the index for a given Scene object contained in the Director.
Parameters:
scene
{CAAT.Foundation.Scene}

getValueForKey(key)
Parameters:
key

glFlush()

glRender(vertex, coordsIndex, uv)
Render buffered elements.
Parameters:
vertex
coordsIndex
uv

glReset()

inDirtyRect()

initialize(width, height, canvas, proxy)
This method performs Director initialization. Must be called once. If the canvas parameter is not set, it will create a Canvas itself, and the developer must explicitly add the canvas to the desired DOM position. This method will also set the Canvas dimension to the specified values by width and height parameters.
Parameters:
width
{number} a canvas width
height
{number} a canvas height
canvas
{HTMLCanvasElement=} An optional Canvas object.
proxy
{HTMLElement} this object can be an event proxy in case you'd like to layer different elements and want events delivered to the correct element.
Returns:
this

initializeGL(width, height, canvas, proxy)
Experimental. Initialize a gl enabled director.
Parameters:
width
height
canvas
proxy

isMusicEnabled()

isSoundEffectsEnabled()

loop(fps, callback, callback2)
Parameters:
fps
callback
callback2

mouseDown(mouseEvent)
Parameters:
mouseEvent

mouseDrag(mouseEvent)
Parameters:
mouseEvent

mouseEnter(mouseEvent)
Parameters:
mouseEvent

mouseExit(mouseEvent)
Parameters:
mouseEvent

mouseMove(mouseEvent)
Parameters:
mouseEvent

mouseUp(mouseEvent)
Parameters:
mouseEvent

musicPlay(id)
Parameters:
id

musicStop()

render(time)
This is the entry point for the animation system of the Director. The director is fed with the elapsed time value to maintain a virtual timeline. This virtual timeline will provide each Scene with its own virtual timeline, and will only feed time when the Scene is the current Scene, or is being switched. If dirty rectangles are enabled and canvas is used for rendering, the dirty rectangles will be set up as a single clip area.
Parameters:
time
{number} integer indicating the elapsed time between two consecutive frames of the Director.

renderFrame()
Starts the director animation.If no scene is explicitly selected, the current Scene will be the first scene added to the Director.

The fps parameter will set the animation quality. Higher values, means CAAT will try to render more frames in the same second (at the expense of cpu power at least until hardware accelerated canvas rendering context are available). A value of 60 is a high frame rate and should not be exceeded.


renderToContext(ctx, scene)
This method draws an Scene to an offscreen canvas. This offscreen canvas is also a child of another Scene (transitionScene). So instead of drawing two scenes while transitioning from one to another, first of all an scene is drawn to offscreen, and that image is translated.

Until the creation of this method, both scenes where drawn while transitioning with its performance penalty since drawing two scenes could be twice as expensive than drawing only one.

Though a high performance increase, we should keep an eye on memory consumption.

Parameters:
ctx
a canvas.getContext('2d') instnce.
scene
{CAAT.Foundation.Scene} the scene to draw offscreen.

requestRepaint()

<private> resetStats()
Reset statistics information.

resetTimeline()
If the director has renderingMode: DIRTY, the timeline must be reset to register accurate frame measurement.

scheduleDirtyRect(rectangle)
This method is used when asynchronous operations must produce some dirty rectangle painting. This means that every operation out of the regular CAAT loop must add dirty rect operations by calling this method. For example setVisible() and remove.
Parameters:
rectangle

setAudioFormatExtensions(extensions)
Parameters:
extensions

setBounds(x, y, w, h)
Set this director's bounds as well as its contained scenes.
Parameters:
x
{number} ignored, will be 0.
y
{number} ignored, will be 0.
w
{number} director width.
h
{number} director height.
Returns:
this

setClear(clear)
This method states whether the director must clear background before rendering each frame. The clearing method could be: + CAAT.Director.CLEAR_ALL. previous to draw anything on screen the canvas will have clearRect called on it. + CAAT.Director.CLEAR_DIRTY_RECTS. Actors marked as invalid, or which have been moved, rotated or scaled will have their areas redrawn. + CAAT.Director.CLEAR_NONE. clears nothing.
Parameters:
clear
{CAAT.Director.CLEAR_ALL | CAAT.Director.CLEAR_NONE | CAAT.Director.CLEAR_DIRTY_RECTS}
Returns:
this.

setGLCurrentOpacity(opacity)
Parameters:
opacity

setGLTexturePage(tp)
Parameters:
tp

setImagesCache(imagesCache, tpW, tpH)
Parameters:
imagesCache
tpW
tpH

setMusicEnabled(enabled)
Parameters:
enabled

setScaleProportional(w, h)
Parameters:
w
h

setScene(sceneIndex)
Changes (or sets) the current Director scene to the index parameter. There will be no transition on scene change.
Parameters:
sceneIndex
{number} an integer indicating the index of the target Scene to be shown.

setSoundEffectsEnabled(enabled)
Parameters:
enabled

setValueForKey(key, value)
Parameters:
key
value

setVolume(id, volume)
Parameters:
id
volume

switchToNextScene(time, alpha, transition)
Sets the previous Scene in sequence as the current Scene.
Parameters:
time
{number} integer indicating the time the Scene transition will take.
alpha
{boolean} a boolean indicating whether Scene transition should be fading.
transition
{boolean} a boolean indicating whether the scene change must smoothly animated.
See:
switchToScene.

switchToPrevScene(time, alpha, transition)
Sets the previous Scene in sequence as the current Scene.
Parameters:
time
{number} integer indicating the time the Scene transition will take.
alpha
{boolean} a boolean indicating whether Scene transition should be fading.
transition
{boolean} a boolean indicating whether the scene change must smoothly animated.
See:
switchToScene.

switchToScene(iNewSceneIndex, time, alpha, transition)
This method will change the current Scene by the Scene indicated as parameter. It will apply random values for anchor and transition type.
Parameters:
iNewSceneIndex
{number} an integer indicating the index of the new scene to run on the Director.
time
{number} an integer indicating the time the Scene transition will take.
alpha
{boolean} a boolean indicating whether Scene transition should be fading.
transition
{boolean} a boolean indicating whether the scene change must smoothly animated.
See:
easeInOutRandom

updateGLPages()

windowResized(w, h)
Parameters:
w
h

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 01 2013 04:59:18 GMT-0700 (PDT)