text(text, x, y, font, color, shadow) → {Phaser.BitmapData}
Draws text to the BitmapData in the given font and color.
The default font is 14px Courier, so useful for quickly drawing debug text.
If you need to do a lot of font work to this BitmapData we'd recommend implementing your own text draw method.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
text | string | The text to write to the BitmapData. | ||
x | number | The x coordinate of the top-left of the text string. | ||
y | number | The y coordinate of the top-left of the text string. | ||
font | string | <optional> | '14px Courier' | The font. This is passed directly to Context.font, so anything that can support, this can. |
color | string | <optional> | 'rgb(255,255,255)' | The color the text will be drawn in. |
shadow | boolean | <optional> | true | Draw a single pixel black shadow below the text (offset by text.x/y + 1) |
Returns
This BitmapData object for method chaining.
- Source code: gameobjects/BitmapData.js (Line 1849)
Please login to continue.