Class: TextRendererComponent

TextRendererComponent

FM.TextRendererComponent

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.
Author:
  • Simon Chauvin
Source:

Extends

Members

fillStyle :string

The color of the font.
Type:
  • string
Source:

font :string

The font size and font name to use.
Type:
  • string
Source:

height :int

Height of the text container.
Type:
  • int
Source:

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
Source:

textBaseline :string

Alignment of the text.
Type:
  • string
Source:

width :int

With of the text container.
Type:
  • int
Source:

Methods

destroy()

Destroy the component and its objects.
Source:

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.
Source:

getHeight() → {int}

Retrieve the height of the text container.
Source:
Returns:
The height of the text container.
Type
int

getWidth() → {int}

Retrieve the width of the text container.
Source:
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.
Source: