CanvasLayer

open class CanvasLayer : Node

A Node that uses a separate OrthographicCamera for rendering instead of the inherited camera from the SceneGraph. This is useful to render a list of nodes with a camera a certain way and another list of nodes another way.

For example: When rendering certain nodes at a low resolution using a Viewport to render UI at a higher resolution.

Author

Colton Daily

Constructors

Link copied to clipboard

Functions

Link copied to clipboard
fun addChild(child: Node): Node

Sets the parent of the child to this Node.

Link copied to clipboard
fun addChildAt(child: Node, index: Int): Node

Sets the parent of the child to this Node sets it at the specified index.

Link copied to clipboard
fun addChildren(vararg children: Node): Node

Sets the parent of the children to this Node.

Link copied to clipboard
open fun callInput(event: InputEvent<*>)
Link copied to clipboard
open fun callUnhandledInput(event: InputEvent<*>)
Link copied to clipboard

Convert canvas coordinates to screen coordinates.

Link copied to clipboard
open operator override fun compareTo(other: Node): Int

Compares Node by depth and position at each depth.

Link copied to clipboard
fun destroy()

Remove the Node from the SceneGraph and destroys all children.

Link copied to clipboard

Removes & destroys all children nodes.

Link copied to clipboard
fun enabled(value: Boolean): Node

Enables/disables the Node. When disabled colliders are removed from the Physics system and will not be called.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Determines if this Node has zero children nodes.

Link copied to clipboard

Determines if this Node contains any children.

Link copied to clipboard
operator fun minusAssign(child: Node)
Link copied to clipboard
fun moveChild(child: Node, index: Int): Node

Moves a child node to the specified index.

Link copied to clipboard
open fun onDescendantAdded(child: Node)
Link copied to clipboard
open fun onDescendantRemoved(child: Node)
Link copied to clipboard
open override fun onDestroy()

Called when destroy is invoked and all of its children have been destroyed.

Link copied to clipboard
open fun parent(parent: Node?): Node

Sets the parent Node of this Node.

Link copied to clipboard
operator fun plusAssign(child: Node)
Link copied to clipboard
Link copied to clipboard
open override fun propagateHit(hx: Float, hy: Float): Control?
Link copied to clipboard
open override fun propagateInput(event: InputEvent<*>): Boolean
Link copied to clipboard
open override fun propagateInternalDebugRender(batch: Batch, camera: Camera, camera3d: Camera, shapeRenderer: ShapeRenderer, renderCallback: (Node, Batch, Camera, Camera, ShapeRenderer) -> Unit?)
Link copied to clipboard
open override fun propagateInternalRender(batch: Batch, camera: Camera, camera3d: Camera, shapeRenderer: ShapeRenderer, renderCallback: (Node, Batch, Camera, Camera, ShapeRenderer) -> Unit?)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun propagateResize(width: Int, height: Int, center: Boolean)
Link copied to clipboard
open override fun propagateUnhandledInput(event: InputEvent<*>): Boolean
Link copied to clipboard
Link copied to clipboard
fun removeChild(child: Node): Node

Removes the node if this node is its parent.

Link copied to clipboard

Removes the child at the specified index.

Link copied to clipboard
open fun render(batch: Batch, shapeRenderer: ShapeRenderer, renderCallback: (Node, Batch, Camera, Camera, ShapeRenderer) -> Unit?)
Link copied to clipboard

Convert screen coordinates to local canvas coordinates.

Link copied to clipboard

Sends the child node at the specified index to the bottom of this list which will be rendered on top.

Link copied to clipboard

Sends the child node at the specified index to the top of this list which will be rendered behind.

Link copied to clipboard

Sends the child node to the bottom of this list which will be rendered on top.

Link copied to clipboard
fun sendChildToTop(child: Node): Node

Sends the child node to the top of this list which will be rendered behind.

Link copied to clipboard
fun swapChildren(child: Node, child2: Node): Node

Swaps the two children positions within the parents list

Link copied to clipboard
fun swapChildrenAt(idx: Int, idx2: Int): Node

Swaps children positions at the specified indices.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
Link copied to clipboard

Properties

Link copied to clipboard
var canvas: CanvasLayer? = null

The CanvasLayer that this Node belongs to. The closest parent CanvasLayer will be selected. If none are found, the scene root viewport will be used.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The current child count for this Node. Alias for NodeList.size.

Link copied to clipboard

The children of this Node. Alias for nodes.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Enables/disables the node.

Link copied to clipboard

Attempts to grab the SceneGraph.fixedProgressionRatio. Defaults to 1 if not.

Link copied to clipboard
var height: Int

Height of the viewport

Link copied to clipboard
val id: Int

Unique identifier for this node.

Link copied to clipboard
val index: Int

The index of this Node as a child in it's parent.

Link copied to clipboard

Check if this Node is in a SceneGraph

Link copied to clipboard

If destroy was called, this will be true until the next time node's are processed.

Link copied to clipboard
Link copied to clipboard

Node name. useful for doing scene-wide searches for an node

Link copied to clipboard

The list of Nodes in this scene.

Link copied to clipboard

List of 'addedToScene' callbacks called when onAddedToScene is called. Add any additional callbacks directly to this list. The main use is to add callbacks directly to nodes inline when building a SceneGraph vs having to extend a class directly.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

List of 'destroy' callbacks called when destroy is called. Add any additional callbacks directly to this list. The main use is to add callbacks directly to nodes inline when building a SceneGraph vs having to extend a class directly.

Link copied to clipboard

List of 'onDisabled' callbacks called when onDisabled is called. Add any additional callbacks directly to this list. The main use is to add callbacks directly to nodes inline when building a SceneGraph vs having to extend a class directly.

Link copied to clipboard

List of 'onEnabled' callbacks called when onEnabled is called. Add any additional callbacks directly to this list. The main use is to add callbacks directly to nodes inline when building a SceneGraph vs having to extend a class directly.

Link copied to clipboard

List of 'fixed-update' callbacks called when fixedUpdate is called. Add any additional callbacks directly to this list. The main use is to add callbacks directly to nodes inline when building a SceneGraph vs having to extend a class directly.

Link copied to clipboard

List of 'input' callbacks called when input is called. Add any additional callbacks directly to this list. The main use is to add callbacks directly to nodes inline when building a SceneGraph vs having to extend a class directly.

Link copied to clipboard

List of 'post-update' callbacks called when postUpdate is called. Add any additional callbacks directly to this list. The main use is to add callbacks directly to nodes inline when building a SceneGraph vs having to extend a class directly.

Link copied to clipboard

List of 'pre-update' callbacks called when preUpdate is called. Add any additional callbacks directly to this list. The main use is to add callbacks directly to nodes inline when building a SceneGraph vs having to extend a class directly.

Link copied to clipboard

List of 'ready' callbacks called when ready is called. Add any additional callbacks directly to this list. The main use is to add callbacks directly to nodes inline when building a SceneGraph vs having to extend a class directly.

Link copied to clipboard

List of 'removedFromScene' callbacks called when onRemovedFromScene is called. Add any additional callbacks directly to this list. The main use is to add callbacks directly to nodes inline when building a SceneGraph vs having to extend a class directly.

Link copied to clipboard
Link copied to clipboard

List of 'resize' callbacks called when resize is called. Add any additional callbacks directly to this list. The main use is to add callbacks directly to nodes inline when building a SceneGraph vs having to extend a class directly.

Link copied to clipboard

Signal that is emitted when the viewport dimensions are changed by the CanvasLayer.

Link copied to clipboard

List of 'unhandledInput' callbacks called when unhandledInput is called. Add any additional callbacks directly to this list. The main use is to add callbacks directly to nodes inline when building a SceneGraph vs having to extend a class directly.

Link copied to clipboard

List of 'update' callbacks called when update is called. Add any additional callbacks directly to this list. The main use is to add callbacks directly to nodes inline when building a SceneGraph vs having to extend a class directly.

Link copied to clipboard
var parent: Node?

The parent Node, if any.

Link copied to clipboard
val ppu: Float

Pixels per unit. Mainly used when rendering a Node. This is based off of the SceneGraph.ppu.

Link copied to clipboard

The inverse of ppu. This is based off the SceneGraph.ppuInv.

Link copied to clipboard
var scene: SceneGraph<*>?

The scene this node belongs to.

Link copied to clipboard

Specifies how often this node's update method should be called. 1 means every frame, 2 is every other, etc

Link copied to clipboard

Viewport instance that can be used for rendering children nodes in inherited classes. This is not used directly in the base CanvasLayer class.

Link copied to clipboard

The viewport virtual/world height

Link copied to clipboard

The viewport virtual/world width

Link copied to clipboard
var width: Int

Width of the viewport

Link copied to clipboard
var x: Int

Viewport x-coord

Link copied to clipboard
var y: Int

Viewport y-coord

Inheritors

Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
inline fun Node.button(callback: Button.() -> Unit = {}): Button

Adds a Button to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.camera2d(callback: Camera2D.() -> Unit = {}): Camera2D

Adds a Camera2D to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.camera3d(callback: Camera3D.() -> Unit = {}): Camera3D

Adds a Camera3D to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.canvasLayer(callback: CanvasLayer.() -> Unit = {}): CanvasLayer

Adds a CanvasLayer to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.centerContainer(callback: CenterContainer.() -> Unit = {}): CenterContainer

Adds a CenterContainer to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.column(callback: VBoxContainer.() -> Unit = {}): VBoxContainer

Adds a VBoxContainer to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.container(callback: Container.() -> Unit = {}): Container

Adds a Container to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.control(callback: Control.() -> Unit = {}): Control

Adds a Control to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.directionalLight(callback: DirectionalLight.() -> Unit = {}): DirectionalLight

Adds a DirectionalLight to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun <T : Node> Node.findFirstNodeOfType(): T?
Link copied to clipboard
inline fun Node.frameBuffer(callback: FrameBufferNode.() -> Unit = {}): FrameBufferNode
Link copied to clipboard

Adds a FrameBufferContainer to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.hBoxContainer(callback: HBoxContainer.() -> Unit = {}): HBoxContainer

Adds a HBoxContainer to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.hScrollBar(callback: HScrollBar.() -> Unit = {}): HScrollBar

Adds a HScrollBar to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.label(callback: Label.() -> Unit = {}): Label

Adds a Label to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.lineEdit(callback: LineEdit.() -> Unit = {}): LineEdit

Adds a LineEdit to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.meshNode(callback: MeshNode.() -> Unit = {}): MeshNode

Adds a MeshNode to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.ninePatchRect(callback: NinePatchRect.() -> Unit = {}): NinePatchRect

Adds a NinePatchRect to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.node(callback: Node.() -> Unit = {}): Node

Adds a Node to the current Node as a child and then triggers the callback

inline fun <T : Node> Node.node(node: T, callback: T.() -> Unit = {}): T

Adds the specified Node to the current Node as a child and then triggers the callback. This can be used for classes that extend node that perhaps they don't have a DSL method to initialize it.

Link copied to clipboard
inline fun Node.node2d(callback: Node2D.() -> Unit = {}): Node2D

Adds a Node2D to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.node3d(callback: Node3D.() -> Unit = {}): Node3D

Adds a Node3D to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.paddedContainer(callback: PaddedContainer.() -> Unit = {}): PaddedContainer

Adds a PaddedContainer to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.panel(callback: Panel.() -> Unit = {}): Panel

Adds a Panel to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.panelContainer(callback: PanelContainer.() -> Unit = {}): PanelContainer

Adds a PanelContainer to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.progressBar(callback: ProgressBar.() -> Unit = {}): ProgressBar

Adds a ProgressBar to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.row(callback: HBoxContainer.() -> Unit = {}): HBoxContainer

Adds a HBoxContainer to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.scrollContainer(callback: ScrollContainer.() -> Unit = {}): ScrollContainer

Adds a ScrollContainer to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.textureProgress(callback: TextureProgress.() -> Unit = {}): TextureProgress

Adds a TextureProgress to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.textureRect(callback: TextureRect.() -> Unit = {}): TextureRect

Adds a TextureRect to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.vBoxContainer(callback: VBoxContainer.() -> Unit = {}): VBoxContainer

Adds a VBoxContainer to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.viewport(callback: ViewportCanvasLayer.() -> Unit = {}): ViewportCanvasLayer

Adds a ViewportCanvasLayer to the current Node as a child and then triggers the callback

Link copied to clipboard
inline fun Node.vScrollBar(callback: VScrollBar.() -> Unit = {}): VScrollBar

Adds a VScrollBar to the current Node as a child and then triggers the callback