Class: FontRenderable

FontRenderable(aString) → {FontRenderable}

Supports the drawing of a string based on a selected Font

Found in Chapter 5, page 253 of the textbook

Example: 5.4 Font Support

Constructor

new FontRenderable(aString) → {FontRenderable}

Parameters:
Name Type Description
aString string the text to render
Source:
Returns:
a new FontRenderable instance
Type
FontRenderable

Methods

draw(camera)

Draw this FontRenderable to the camera
Parameters:
Name Type Description
camera Camera the Camera to draw to
Source:

getColor() → {Array.<float>}

Returns the color of this FontRenderable
Source:
Returns:
[R,G,B,A] color array
Type
Array.<float>

getFontName() → {string}

Returns the path to font being used by this FontRenderable
Source:
Returns:
mFontName - the path to the resource file
Type
string

getText() → {string}

Returns the text of this FontRenderable
Source:
Returns:
mText - the text
Type
string

getXform() → {Transform}

Returns the Transform of this FontRenderable
Source:
Returns:
mXform - the Transform
Type
Transform

setColor(c)

Set the color of this FontRenderable
Parameters:
Name Type Description
c Array.<float> [R,G,B,A] color array
Source:

setFontName(f)

Set the path to the font file this FontRenderable uses
Parameters:
Name Type Description
f string the path to the font resource file
Source:

setText(t)

Set the text for this FontRenderable
Parameters:
Name Type Description
t string the new text
Source:

setTextHeight(h)

Set the world coordinate height of the text
Parameters:
Name Type Description
h float the new height
Source: