[back to index]

Library Reference (v 0.9.0)

Text

For displaying text on screen.
Text.font:String
Set the font to a font from data/graphics/fonts/
Text.size:Float
Change the size of the font. For ttf fonts, sizes are given in point format - e.g. 16, 32, 48, etc. For bitmap fonts, sizes are given in multiple scales - 1 is normal, 2 is double size, 3 is triple, etc.
Text.display(x:Float, y:Float, text:String, color:Int = 0xFFFFFF)
Draws text on the screen at a given point.
Text.input(x:Float, y:Float, prompt:String, questioncolor:Int = 0xFFFFFF, answercolor:Int  = 0xCCCCCC):Bool
Displays a prompt on screen where you can type a string. Returns true when the user presses Key.ENTER.
Text.getinput():String
Returns the most recent value of Text.input() after Key.ENTER has been pressed.
Text.inputmaxlength:Int
Sets maximum response length of Text.input().
Text.wordwrap:Int
Sets the word-wrap width for Text.display() commands.
Text.rotation(angle:Float, pivotx:Int, pivoty:Int)
Sets the rotation of Text.display() commands. (pivotx, pivoty) can be a point, or it can use the constants Text.LEFT, Text.CENTER or Text.RIGHT.
Text.align(position)
Sets the alignment for Text.display() commands. Pass either Text.LEFT, Text.CENTER or Text.RIGHT.
Text.width(text:String):Float
Returns the width in pixels of the given string.
Text.height(text:String):Float
Returns the height in pixels of the given string. If text is left blank, it returns the height in pixels of any line of text in the current font.
Text.CENTER
A constant passed to functions like Text.align() and Text.rotation().
Text.LEFT
A constant passed to functions like Text.align() and Text.rotation().
Text.RIGHT
A constant passed to functions like Text.align() and Text.rotation().
Text.TOP
A constant passed to functions like Text.align() and Text.rotation().
Text.BOTTOM
A constant passed to functions like Text.align() and Text.rotation().