Static methods

Constructor

@:value({ font : Canvas.defaultFontName })new(canvasName:String, font:String = Canvas.defaultFontName)

Create new CanvasScript from canvas

Parameters:

canvasName

Name of the canvas

font

font file (Optional)

Variables

Methods

getCanvas():Null<TCanvas>

Returns the canvas object of this trait.

Returns:

TCanvas

inlinegetCanvasVisible():Bool

Get whether the active canvas is visible.

getElement(name:String):TElement

Returns an element of the canvas.

Parameters:

name

The name of the element

Returns:

TElement

getElements():Array<TElement>

Returns an array of the elements of the canvas.

Returns:

Array

@:access(armory.ui.Canvas)@:access(zui.Handle)getHandle(name:String):Handle

inlinegetUiScale():Float

Get the UI scale factor.

notifyOnReady(f:() ‑> Void):Void

Run the given callback function f when the canvas is loaded and ready.

See also:

setCanvasDimensions(x:Int, y:Int):Void

Set dimensions of canvas

Parameters:

x

Width

y

Height

setCanvasFontSize(fontSize:Int):Void

Set font size of the canvas

Parameters:

fontSize

Size of font to be setted

inlinesetCanvasVisibility(visible:Bool):Void

Deprecated: "Please use setCanvasVisible() instead"

inlinesetCanvasVisible(visible:Bool):Void

Set whether the active canvas is visible.

Note that elements of invisible canvases are not rendered and computed, so it is not possible to interact with those elements on the screen.

inlinesetUiScale(factor:Float):Void

Set the UI scale factor.

Inherited Variables

Defined by Trait

@:value("")name:String = ""

object:Object

Object this trait belongs to.

Inherited Methods

Defined by Trait

notifyOnAdd(f:() ‑> Void):Void

Trait is added to an object.

notifyOnInit(f:() ‑> Void):Void

Object which this trait belongs to is added to scene.

notifyOnLateUpdate(f:() ‑> Void):Void

Add late game logic handler.

notifyOnRemove(f:() ‑> Void):Void

Object which this trait belongs to is removed from scene.

notifyOnRender(f:Graphics ‑> Void):Void

Add render handler.

notifyOnRender2D(f:Graphics ‑> Void):Void

Add 2D render handler.

notifyOnUpdate(f:() ‑> Void):Void

Add game logic handler.

remove():Void

Remove the trait from the object.

removeLateUpdate(f:() ‑> Void):Void

Remove late game logic handler.

removeRender(f:Graphics ‑> Void):Void

Remove render handler.

removeRender2D(f:Graphics ‑> Void):Void

Remove 2D render handler.

removeUpdate(f:() ‑> Void):Void

Remove game logic handler.