new TextRendererComponent(pTextToDisplay, pOwner)
A component for rendering text.
Parameters:
Name | Type | Description |
---|---|---|
pTextToDisplay |
string | The text to be rendered. |
pOwner |
FM.GameObject | The game object that owns this component. |
Extends
Members
-
fillStyle :string
-
The color of the font.
Type:
- string
-
font :string
-
The font size and font name to use.
Type:
- string
-
height :int
-
Height of the text container.
Type:
- int
-
name :FM.ComponentTypes
-
Component's name.
Type:
- Inherited From:
- Source:
-
owner :FM.GameObject
-
Component's owner.
Type:
- Inherited From:
- Source:
-
text :string
-
Text to be displayed.
Type:
- string
-
textBaseline :string
-
Alignment of the text.
Type:
- string
-
width :int
-
With of the text container.
Type:
- int
Methods
-
destroy()
-
Destroy the component and its objects.
-
draw(bufferCanvas, newPosition)
-
Draw the text.
Parameters:
Name Type Description bufferCanvas
CanvasRenderingContext2D The context on which to draw. newPosition
FM.Vector The position to draw the text. -
getHeight() → {int}
-
Retrieve the height of the text container.
Returns:
The height of the text container.- Type
- int
-
getWidth() → {int}
-
Retrieve the width of the text container.
Returns:
The width of the text container.- Type
- int
-
setFormat(pColor, pFont, pAlignment)
-
Format the text.
Parameters:
Name Type Description pColor
string The color of the text. pFont
string The font size and name of the text. pAlignment
string Alignment of the text.