Scenes Documentation Beta

Class Layer

open class Layer : IdentifiableObject 

A Layer is responsible for providing subclassed RenderableEntity objects.

%81 Layer Layer IdentifiableObject IdentifiableObject Layer->IdentifiableObject

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

owning​Scene

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().

move​Z(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().

set​Transforms(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().

set​Alpha(alpha:​)

public func setAlpha(alpha:Alpha?) 

Sets the alpha component for this layer. This function should only be invoked during init(), setup(), or calculate().

debug​Entity​List()

public func debugEntityList() 

Prints list of entities from back to front.

pre​Setup(canvas​Size:​canvas:​)

open func preSetup(canvasSize:Size, canvas:Canvas) 

This function is invoked immediately prior to setting up entities.

post​Setup(canvas​Size:​canvas:​)

open func postSetup(canvasSize:Size, canvas:Canvas) 

This function is invoked immediately after setting up entities.

pre​Teardown()

open func preTeardown() 

This function is invoked immediately prior to tearing down layers.

post​Teardown()

open func postTeardown() 

This function is invoked immediately after tearing down layers.

pre​Calculate(canvas:​)

open func preCalculate(canvas:Canvas) 

This function is invoked immediately prior to calculating entities.

post​Calculate(canvas:​)

open func postCalculate(canvas:Canvas) 

This function is invoked immediately after calculating entities.

pre​Render(canvas:​)

open func preRender(canvas:Canvas) 

This function is invoked immediately prior to rendering entities.

post​Render(canvas:​)

open func postRender(canvas:Canvas) 

This function is invoked immediately after rendering entities.

is​Mouse​Transparent()

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.

is​Visible()

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.