Packagecom.pblabs.rendering2D
Interfacepublic interface IScene2D
Implementors DisplayObjectScene

Base interface for a 2d scene. A scene contains multiple layers, and has a camera transform which is applied to pan/rotate/zoom the view. The scene is responsible for tracking and rendering all the drawable objects in the world.

See also

DisplayObjectRenderer
DisplayObjectScene


Public Properties
 PropertyDefined By
  layerCount : int
[read-only] Layers are assigned positive integers between 0 and N.
IScene2D
  position : Point
The location of the view onto the scene.
IScene2D
  rotation : Number
Rotation in degrees about the center point of the scene.
IScene2D
  sceneAlignment : SceneAlignment
How the scene is aligned relative to its position property.
IScene2D
  sceneView : IUITarget
The SceneView where the contents of this scene will be displayed.
IScene2D
  sceneViewBounds : Rectangle
[read-only] The region of the scene we are currently viewing.
IScene2D
  trackLimitRectangle : Rectangle
If set, this clamps the camera to scroll no further than its boundaries
IScene2D
  zoom : Number
Zoom/scale factor; 1 = no zoom, less than 1 = zoom out, greater than 1 = zoom in.
IScene2D
Public Methods
 MethodDefined By
  
Add a DisplayObjectRenderer to the scene; all you normally have to do is set scene on DisplayObjectRenderer, not call this directly.
IScene2D
  
getLayer(index:int, allocateIfAbsent:Boolean = false):DisplayObjectSceneLayer
Get the layer at specified index.
IScene2D
  
getRenderersUnderPoint(screenPosition:Point, results:Array, mask:ObjectType = null):Boolean
Return a sorted list of the DisplayObjectRenderers under a given screen position.
IScene2D
  
invalidate(dirtyRenderer:DisplayObjectRenderer):void
Indicates that a renderer has changed, and must be redrawn.
IScene2D
  
invalidateRectangle(dirty:Rectangle):void
Just like invalidate, but indicates a specific region in scene coordinates.
IScene2D
  
Remove a DisplayObjectRenderer from the scene; all you normally have to do is clear scene on DisplayObjectRenderer, or destroy its owning entity, not call this directly.
IScene2D
  
screenPan(deltaX:int, deltaY:int):void
Pan-the view by (deltaX, deltaY) screen pixels.
IScene2D
  
setWorldCenter(position:Point):void
Center the view on a position in world space.
IScene2D
  
sortSpatials(array:Array):void
IScene2D
  
transformSceneToScreen(inPos:Point):Point
IScene2D
  
transformSceneToWorld(inPos:Point):Point
IScene2D
  
transformScreenToScene(inPos:Point):Point
IScene2D
  
transformScreenToWorld(inPos:Point):Point
IScene2D
  
transformWorldToScene(inPos:Point):Point
IScene2D
  
transformWorldToScreen(inPos:Point):Point
IScene2D
Property Detail
layerCountproperty
layerCount:int  [read-only]

Layers are assigned positive integers between 0 and N. This tells you what N is. This can be the same as how many layers there are, but you might only be using layers 2,3, and 7, in which case layerCount will be 8, but there will only be three layers.

layerCount is mostly useful in order to iterate over all the layers by calling getLayer.


Implementation
    public function get layerCount():int

See also

getLayer
positionproperty 
position:Point

The location of the view onto the scene. This is affected by sceneAlignment.


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

Rotation in degrees about the center point of the scene.


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 SceneView where the contents of this scene will be displayed.


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

The region of the scene we are currently viewing.


Implementation
    public function get sceneViewBounds():Rectangle
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
zoomproperty 
zoom:Number

Zoom/scale factor; 1 = no zoom, less than 1 = zoom out, greater than 1 = zoom in.


Implementation
    public function get zoom():Number
    public function set zoom(value:Number):void
Method Detail
add()method
public function add(dor:DisplayObjectRenderer):void

Add a DisplayObjectRenderer to the scene; all you normally have to do is set scene on DisplayObjectRenderer, not call this directly.

Parameters

dor:DisplayObjectRenderer

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

Get the layer at specified index.

Parameters

index:int — Index of layer to return.
 
allocateIfAbsent:Boolean (default = false) — False by default. If true, will allocate a new layer if none is present.

Returns
DisplayObjectSceneLayer — The requested layer.
getRenderersUnderPoint()method 
public function getRenderersUnderPoint(screenPosition:Point, results:Array, mask:ObjectType = null):Boolean

Return a sorted list of the DisplayObjectRenderers under a given screen position.

Parameters

screenPosition:Point — Location on screen we are curious about.
 
results:Array — An array into which DisplayObjectRenderers are added based on what is under point.
 
mask:ObjectType (default = null) — Only renderers with one or more of these bits set on their objectMask will be returned. Null uses all types.

Returns
Boolean — Found something under point or not.
invalidate()method 
public function invalidate(dirtyRenderer:DisplayObjectRenderer):void

Indicates that a renderer has changed, and must be redrawn. Only necessary if you are using layers that implement ICachingLayer (you don't by default).

Parameters

dirtyRenderer:DisplayObjectRenderer — The renderer that has changed.

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

Just like invalidate, but indicates a specific region in scene coordinates. All layers will have that region redrawn.

Parameters

dirty:Rectangle — The region to redraw.

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

Remove a DisplayObjectRenderer from the scene; all you normally have to do is clear scene on DisplayObjectRenderer, or destroy its owning entity, not call this directly.

Parameters

dor:DisplayObjectRenderer

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

Pan-the view by (deltaX, deltaY) screen pixels. This takes into account zoom.

Parameters

deltaX:int
 
deltaY:int

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

Center the view on a position in world space.

Parameters

position: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