new Text(text, xopt, yopt, styleopt, sizeopt)
A drawable string of text
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
text | String | The text string to draw | ||
x | Number | <optional> | 0 | x coordinate of the top left of the text |
y | Number | <optional> | 0 | y coordinate of the top left of the text |
style | gameify. | <optional> | The text style | |
size | Number | <optional> | 48 | The text size, in pixels |
Example
// A text label
let myText = new gameify.Text("Hello, World", 0, 0);Members
position :gameify.Vector2d
The position of the text top left corner of the text
Type:
size :Number
The text size, in pixels
Type:
- Number
string :String
The string of text to draw
Type:
- String
style :gameify.TextStyle
The text style
Type:
Methods
draw()
Draw the Text
getParent() → {gameify.Screen}
Get the screen this sprite draws to
Returns:
- Type:
- gameify.
Screen