Packagecom.pblabs.rendering2D
Classpublic class DisplayObjectScene
InheritanceDisplayObjectScene Inheritance AnimatedComponent Inheritance EntityComponent Inheritance Object
Implements IScene2D
Subclasses BitmapDataScene

Basic Rendering2D scene; it is given a SceneView and some DisplayObjectRenderers, and makes sure that they are drawn. Extensible for more complex rendering scenarios. Enforces sorting order, too.



Public Properties
 PropertyDefined By
 InheritedisRegistered : Boolean
[read-only] Whether or not the component is currently registered with an entity.
EntityComponent
  layerCount : int
[read-only]
DisplayObjectScene
  layers : Array
Holds DisplayObjectSceneLayer instances to use for various layers.
DisplayObjectScene
  maxZoom : Number = 1
Maximum allowed zoom level.
DisplayObjectScene
  minZoom : Number = .01
Minimum allowed zoom level.
DisplayObjectScene
 Inheritedname : String
[read-only] The name given to the component when it is added to an entity.
EntityComponent
 Inheritedowner : IEntity
A reference to the entity that this component currently belongs to.
EntityComponent
  position : Point
DisplayObjectScene
 InheritedregisterForUpdates : Boolean
Set to register/unregister for frame updates.
AnimatedComponent
  rotation : Number
DisplayObjectScene
  sceneAlignment : SceneAlignment
How the scene is aligned relative to its position property.
DisplayObjectScene
  sceneView : IUITarget
The IUITarget to which we will be displaying the scene.
DisplayObjectScene
  sceneViewBounds : Rectangle
[read-only]
DisplayObjectScene
  sceneViewName : String
DisplayObjectScene
  trackLimitRectangle : Rectangle
If set, this clamps the camera to scroll no further than its boundaries
DisplayObjectScene
  trackObject : DisplayObjectRenderer
If set, every frame, trackObject's position is read and assigned to the scene's position, so that the scene follows the trackObject.
DisplayObjectScene
  trackOffset : Point
An x/y offset for adjusting the camera's focus around the tracked object.
DisplayObjectScene
 InheritedupdatePriority : Number = 0.0
The update priority for this component.
AnimatedComponent
  zoom : Number
DisplayObjectScene
Protected Properties
 PropertyDefined By
  _currentWorldCenter : Point
DisplayObjectScene
  _layers : Array
DisplayObjectScene
  _renderers : Dictionary
DisplayObjectScene
  _rootPosition : Point
DisplayObjectScene
  _rootRotation : Number = 0
DisplayObjectScene
  _rootSprite : Sprite
DisplayObjectScene
  _rootTransform : Matrix
DisplayObjectScene
  _sceneAlignment : SceneAlignment
DisplayObjectScene
  _sceneView : IUITarget
DisplayObjectScene
  _sceneViewBoundsCache : Rectangle
DisplayObjectScene
  _sceneViewName : String = null
DisplayObjectScene
  _tempPoint : Point
DisplayObjectScene
  _trackLimitRectangle : Rectangle = null
DisplayObjectScene
  _transformDirty : Boolean = true
DisplayObjectScene
  _zoom : Number = 1
DisplayObjectScene
Public Methods
 MethodDefined By
  
DisplayObjectScene
  
DisplayObjectScene
  
getLayer(index:int, allocateIfAbsent:Boolean = false):DisplayObjectSceneLayer
DisplayObjectScene
  
DisplayObjectScene
  
getRenderersUnderPoint(screenPosition:Point, results:Array, mask:ObjectType = null):Boolean
DisplayObjectScene
  
invalidate(dirtyRenderer:DisplayObjectRenderer):void
DisplayObjectScene
  
invalidateRectangle(dirty:Rectangle):void
DisplayObjectScene
  
onFrame(elapsed:Number):void
[override]
DisplayObjectScene
 Inherited
register(owner:IEntity, name:String):void
Registers the component with an entity.
EntityComponent
  
DisplayObjectScene
 Inherited
reset():void
This is called by an entity on all of its components any time a component is added or removed.
EntityComponent
  
screenPan(deltaX:int, deltaY:int):void
DisplayObjectScene
  
setWorldCenter(pos:Point):void
DisplayObjectScene
  
sortSpatials(array:Array):void
DisplayObjectScene
  
transformSceneToScreen(inPos:Point):Point
DisplayObjectScene
  
transformSceneToWorld(inPos:Point):Point
DisplayObjectScene
  
transformScreenToScene(inPos:Point):Point
DisplayObjectScene
  
transformScreenToWorld(inPos:Point):Point
DisplayObjectScene
  
transformWorldToScene(inPos:Point):Point
DisplayObjectScene
  
transformWorldToScreen(inPos:Point):Point
DisplayObjectScene
 Inherited
unregister():void
Unregisters the component from an entity.
EntityComponent
  
DisplayObjectScene
Protected Methods
 MethodDefined By
  
Convenience funtion for subclasses to control what class of layer they are using.
DisplayObjectScene
  
Convenience function for subclasses to create a custom root sprite.
DisplayObjectScene
  
onAdd():void
[override]
DisplayObjectScene
  
onRemove():void
[override]
DisplayObjectScene
 Inherited
onReset():void
This is called anytime a component is added or removed from the owner entity.
EntityComponent
  
sceneViewResized(event:Event):void
DisplayObjectScene
Property Detail
_currentWorldCenterproperty
protected var _currentWorldCenter:Point

_layersproperty 
protected var _layers:Array

_renderersproperty 
protected var _renderers:Dictionary

_rootPositionproperty 
protected var _rootPosition:Point

_rootRotationproperty 
protected var _rootRotation:Number = 0

_rootSpriteproperty 
protected var _rootSprite:Sprite

_rootTransformproperty 
protected var _rootTransform:Matrix

_sceneAlignmentproperty 
protected var _sceneAlignment:SceneAlignment

_sceneViewproperty 
protected var _sceneView:IUITarget

_sceneViewBoundsCacheproperty 
protected var _sceneViewBoundsCache:Rectangle

_sceneViewNameproperty 
protected var _sceneViewName:String = null

_tempPointproperty 
protected var _tempPoint:Point

_trackLimitRectangleproperty 
protected var _trackLimitRectangle:Rectangle = null

_transformDirtyproperty 
protected var _transformDirty:Boolean = true

_zoomproperty 
protected var _zoom:Number = 1

layerCountproperty 
layerCount:int  [read-only]


Implementation
    public function get layerCount():int
layersproperty 
public var layers:Array

Holds DisplayObjectSceneLayer instances to use for various layers. That is, if index 3 of layers[] holds an instance of DisplayObjectSceneLayer or a subclass, then that instance will be used for layer #3. Note this is only considered at layer setup time. Use getLayer() to get a layer that is being actively used.

maxZoomproperty 
public var maxZoom:Number = 1

Maximum allowed zoom level.

See also

zoom
minZoomproperty 
public var minZoom:Number = .01

Minimum allowed zoom level.

See also

zoom
positionproperty 
position:Point


Implementation
    public function get position():Point
    public function set position(value:Point):void
rotationproperty 
rotation:Number


Implementation
    public function get rotation():Number
    public function set rotation(value:Number):void
sceneAlignmentproperty 
sceneAlignment:SceneAlignment

How the scene is aligned relative to its position property.


Implementation
    public function get sceneAlignment():SceneAlignment
    public function set sceneAlignment(value:SceneAlignment):void

See also

sceneViewproperty 
sceneView:IUITarget

The IUITarget to which we will be displaying the scene. A scene can only draw to on IUITarget at a time.


Implementation
    public function get sceneView():IUITarget
    public function set sceneView(value:IUITarget):void
sceneViewBoundsproperty 
sceneViewBounds:Rectangle  [read-only]


Implementation
    public function get sceneViewBounds():Rectangle
sceneViewNameproperty 
sceneViewName:String


Implementation
    public function get sceneViewName():String
    public function set sceneViewName(value:String):void
trackLimitRectangleproperty 
trackLimitRectangle:Rectangle

If set, this clamps the camera to scroll no further than its boundaries


Implementation
    public function get trackLimitRectangle():Rectangle
    public function set trackLimitRectangle(value:Rectangle):void
trackObjectproperty 
public var trackObject:DisplayObjectRenderer

If set, every frame, trackObject's position is read and assigned to the scene's position, so that the scene follows the trackObject.

trackOffsetproperty 
public var trackOffset:Point

An x/y offset for adjusting the camera's focus around the tracked object. Only applies if trackObject is set.

zoomproperty 
zoom:Number


Implementation
    public function get zoom():Number
    public function set zoom(value:Number):void
Constructor Detail
DisplayObjectScene()Constructor
public function DisplayObjectScene()



Method Detail
add()method
public function add(dor:DisplayObjectRenderer):void

Parameters

dor:DisplayObjectRenderer

generateLayer()method 
protected function generateLayer(layerIndex:int):DisplayObjectSceneLayer

Convenience funtion for subclasses to control what class of layer they are using.

Parameters

layerIndex:int

Returns
DisplayObjectSceneLayer
generateRootSprite()method 
protected function generateRootSprite():Sprite

Convenience function for subclasses to create a custom root sprite.

Returns
Sprite
getLayer()method 
public function getLayer(index:int, allocateIfAbsent:Boolean = false):DisplayObjectSceneLayer

Parameters

index:int
 
allocateIfAbsent:Boolean (default = false)

Returns
DisplayObjectSceneLayer
getRendererForDisplayObject()method 
public function getRendererForDisplayObject(displayObject:DisplayObject):DisplayObjectRenderer

Parameters

displayObject:DisplayObject

Returns
DisplayObjectRenderer
getRenderersUnderPoint()method 
public function getRenderersUnderPoint(screenPosition:Point, results:Array, mask:ObjectType = null):Boolean

Parameters

screenPosition:Point
 
results:Array
 
mask:ObjectType (default = null)

Returns
Boolean
invalidate()method 
public function invalidate(dirtyRenderer:DisplayObjectRenderer):void

Parameters

dirtyRenderer:DisplayObjectRenderer

invalidateRectangle()method 
public function invalidateRectangle(dirty:Rectangle):void

Parameters

dirty:Rectangle

onAdd()method 
override protected function onAdd():void

onFrame()method 
override public function onFrame(elapsed:Number):void

Parameters

elapsed:Number

onRemove()method 
override protected function onRemove():void

remove()method 
public function remove(dor:DisplayObjectRenderer):void

Parameters

dor:DisplayObjectRenderer

sceneViewResized()method 
protected function sceneViewResized(event:Event):void

Parameters

event:Event

screenPan()method 
public function screenPan(deltaX:int, deltaY:int):void

Parameters

deltaX:int
 
deltaY:int

setWorldCenter()method 
public function setWorldCenter(pos:Point):void

Parameters

pos:Point

sortSpatials()method 
public function sortSpatials(array:Array):void

Parameters

array:Array

transformSceneToScreen()method 
public function transformSceneToScreen(inPos:Point):Point

Parameters

inPos:Point

Returns
Point
transformSceneToWorld()method 
public function transformSceneToWorld(inPos:Point):Point

Parameters

inPos:Point

Returns
Point
transformScreenToScene()method 
public function transformScreenToScene(inPos:Point):Point

Parameters

inPos:Point

Returns
Point
transformScreenToWorld()method 
public function transformScreenToWorld(inPos:Point):Point

Parameters

inPos:Point

Returns
Point
transformWorldToScene()method 
public function transformWorldToScene(inPos:Point):Point

Parameters

inPos:Point

Returns
Point
transformWorldToScreen()method 
public function transformWorldToScreen(inPos:Point):Point

Parameters

inPos:Point

Returns
Point
updateTransform()method 
public function updateTransform():void