Back

CreateText

JS Py
Hello World
Content:
- Properties
- Methods

Creates a text label which is used to display texts in your game.

txt = gfx.CreateText( text, fontSize, fontFile, align, callback ) → game object: Text

Properties

The following properties are available on the Text object:

alignString: “left” or “center” or “right”
alphaNumber: fraction (0..1)
angleNumber: fraction (0..1)
fileString: path to file or folder ( “/absolute/...” or “relative/...” )
fontSizeNumber: pixel
heightNumber: fraction (0..1)
pivotXNumber: fraction (0..1)
pivotYNumber: fraction (0..1)
scaleXNumber: factor
scaleYNumber: factor
visibleBoolean
widthNumber

Methods

The following methods are available on the Text object:

Contains( x, y ) → Boolean
Update()
Number
String
Number: fraction (0..1)
String: path to file ( “/absolute/...” or “relative/...” )
String: “left” or “center” or “right”
Object: Matrix
function()
txt.align
Alignment for multiline text. does not affect single line text.
txt.alpha
The objects alpha value
txt.angle
The rotation fraction of the object
txt.Contains
Checks if a point is contained in the sprite
txt.file
Path to the source file.
txt.fontSize
text font size in pixels
txt.height
The height of the object
txt.pivotX
The x pivot for rotations
txt.pivotY
The y pivot for rotations
txt.scaleX
The horizontal scaling
txt.scaleY
The vertical scaling
txt.SetMatrix
Set the individual 2d transformation
txt.Update
Updates internal properties
txt.visible
Indicates the objects visibility state
txt.width
The obects width