Class
Layer
open class Layer : IdentifiableObject
A Layer
is responsible for providing subclassed RenderableEntity
objects.
Relationships
Superclass
IdentifiableObject
IdentifiableObject
provides base functionality for using unique names that are useful for debugging.
Initializers
init(name:)
public override init(name:String?=nil)
Creates a new Layer
from the given parameters:
Parameters
Name | Type | Description |
---|---|---|
name | String? |
The unique name of this layer. While it's very useful for debugging purposes to provide a meaningful name, it's not required. |
Properties
owningScene
public private(set) weak var owningScene : Scene?
scene
public var scene : Scene
The owning scene for this layer.
director
public var director : Director
The owning director for this layer.
dispatcher
public var dispatcher : Dispatcher
The event dispatcher for this layers owning director.
Methods
insert(entity:at:)
public func insert(entity:RenderableEntity, at zLocation:ZOrder<RenderableEntity>)
Inserts the specified renderable entity into this layer at the specified location. This function should only be invoked during init(), setup(), or calculate().
remove(entity:)
public func remove(entity: RenderableEntity)
Removes the specified renderable entity from this layer. This function should only be invoked during init(), setup(), or calculate().
moveZ(of:to:)
public func moveZ(of entity:RenderableEntity, to zLocation:ZOrder<RenderableEntity>)
Moves the z-index value of the specified renderable entity according the the specified location. This function should only be invoked during init(), setup(), or calculate().
setTransforms(transforms:)
public func setTransforms(transforms:[Transform]?)
Sets the transforms to be applied to this layer. This function should only be invoked during init(), setup(), or calculate().
setAlpha(alpha:)
public func setAlpha(alpha:Alpha?)
Sets the alpha component for this layer. This function should only be invoked during init(), setup(), or calculate().
debugEntityList()
public func debugEntityList()
Prints list of entities from back to front.
preSetup(canvasSize:canvas:)
open func preSetup(canvasSize:Size, canvas:Canvas)
This function is invoked immediately prior to setting up entities.
postSetup(canvasSize:canvas:)
open func postSetup(canvasSize:Size, canvas:Canvas)
This function is invoked immediately after setting up entities.
preTeardown()
open func preTeardown()
This function is invoked immediately prior to tearing down layers.
postTeardown()
open func postTeardown()
This function is invoked immediately after tearing down layers.
preCalculate(canvas:)
open func preCalculate(canvas:Canvas)
This function is invoked immediately prior to calculating entities.
postCalculate(canvas:)
open func postCalculate(canvas:Canvas)
This function is invoked immediately after calculating entities.
preRender(canvas:)
open func preRender(canvas:Canvas)
This function is invoked immediately prior to rendering entities.
postRender(canvas:)
open func postRender(canvas:Canvas)
This function is invoked immediately after rendering entities.
isMouseTransparent()
open func isMouseTransparent() -> Bool
This function is invoked to determine whether or not a layer is transparent to entity mouse events. If true, the layer's entities will not intercept such events.
isVisible()
open func isVisible() -> Bool
This function is invoked to determine whether or not a layer is visible. If false, the render phase for this layer and all child entities will be skipped and the render methods will not be invoked.