Class R.text.TextRenderer
A 2d text rendering object. The object hosts the given text
renderer, and a way to position and size the text. It is up
to the renderer provided to present the text within the render
context.
Defined in: textrenderer.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.text.TextRenderer(renderer, text, size)
Create an instance of one of the text renderers.
|
Field Attributes | Field Name and Description |
---|---|
The size of a text element, in pixels
|
|
Draw the text to the context.
|
|
Don't draw the text to the context.
|
Method Attributes | Method Name and Description |
---|---|
Get the class name of this object
|
|
getColor()
Get the color of the text to render
|
|
Get the current drawing mode for the text.
|
|
getText()
Get the text for this object to render.
|
|
Get the horizontal alignment of the text.
|
|
Get the text color
|
|
Get the font for the text.
|
|
Get the size of the text to render.
|
|
Get the style for text.
|
|
Get the weight of the text.
|
|
release()
Release the text renderer back into the pool for reuse
|
|
setColor(color)
Set the color of the text to render.
|
|
setDrawMode(drawMode)
Set the text drawing mode to either #DRAW_TEXT or #NO_DRAW.
|
|
setText(text)
Set the text for this object to render.
|
|
setTextAlignment(alignment)
Set the horizontal alignment of the text.
|
|
setTextColor(textColor)
Set the color of the text.
|
|
setTextFont(font)
Set the font for the text.
|
|
setTextSize(size)
Set the size of the text to render.
|
|
setTextStyle(style)
Set the style of the text.
|
|
setTextWeight(weight)
Set the weight (boldness) of the text.
|
|
update(renderContext, time, dt)
Called to render the text to the context.
|
Class Detail
R.text.TextRenderer(renderer, text, size)
Create an instance of one of the text renderers.
- Parameters:
- renderer
- {AbstractTextRenderer} The text renderer to use
- text
- {String} The text to render
- size
- {Number} The size of the text to render
Field Detail
BASE_TEXT_PIXELSIZE
The size of a text element, in pixels
DRAW_TEXT
Draw the text to the context.
NO_DRAW
Don't draw the text to the context.
Method Detail
{String}
getClassName()
Get the class name of this object
- Returns:
- {String} The string "R.text.TextRenderer"
{String}
getColor()
Get the color of the text to render
- Returns:
- {String} The text color
{Number}
getDrawMode()
Get the current drawing mode for the text.
- Returns:
- {Number} The text drawing mode
{String}
getText()
Get the text for this object to render. This method
must be implemented by a text renderer.
- Returns:
- {String} The text to draw
{Number}
getTextAlignment()
Get the horizontal alignment of the text. This method is optional
for a text renderer.
- Returns:
- {Number} The alignment mode for the given text renderer
{String}
getTextColor()
Get the text color
- Returns:
- {String} The color or style of the line
{String}
getTextFont()
Get the font for the text. This method is optional
for a text renderer.
- Returns:
- {String} The text font
{Number}
getTextSize()
Get the size of the text to render.
- Returns:
- {Number} The size/scale of the text
{String}
getTextStyle()
Get the style for text. This method is optional
for a text renderer.
- Returns:
- {String} The text style
{Object}
getTextWeight()
Get the weight of the text. This method is optional
for a text renderer.
- Returns:
- {Object} The boldness of the given text renderer
release()
Release the text renderer back into the pool for reuse
setColor(color)
Set the color of the text to render.
- Parameters:
- color
- {String} The color of the text
setDrawMode(drawMode)
Set the text drawing mode to either #DRAW_TEXT or #NO_DRAW.
- Parameters:
- drawMode
- {Number} The drawing mode for the text.
setText(text)
Set the text for this object to render. This method
must be implemented by a text renderer.
- Parameters:
- text
- {String} The text to render.
setTextAlignment(alignment)
Set the horizontal alignment of the text. This method is optional
for a text renderer
- Parameters:
- alignment
- {Object} A text alignment mode for the given text renderer.
setTextColor(textColor)
Set the color of the text.
- Parameters:
- textColor
- {String} Color of the text.
setTextFont(font)
Set the font for the text. This method is optional
for a text renderer.
- Parameters:
- font
- {String} The text font
setTextSize(size)
Set the size of the text to render.
- Parameters:
- size
- {Number} Defaults to 1
setTextStyle(style)
Set the style of the text. This method is optional
for a text renderer.
- Parameters:
- style
- {String} The text style
setTextWeight(weight)
Set the weight (boldness) of the text. This method
is optional for a text renderer.
- Parameters:
- weight
- {Object} The boldness of the given text renderer
update(renderContext, time, dt)
Called to render the text to the context.
- Parameters:
- renderContext
- {R.rendercontexts.AbstractRenderContext} The context to render the text into
- time
- {Number} The engine time in milliseconds
- dt
- {Number} The delta between the world time and the last time the world was updated in milliseconds.