Class Index | File Index

Classes


Class text2d


Extends component.
text2d
Defined in: text2d.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
text2d()
Component that can be used to draw high-quality text on-screen.
Field Summary
Field Attributes Field Name and Description
 
Whether the shape should be drawn using the absolute positions of its geometry.
 
Color of the text.
 
The font asset to use.
 
The size of the font, in "points"
 
The rendering mode.
 
The transform of the shape component.
 
See sandboxe.text2d.spacingMode
 
The Text to display.
Fields borrowed from class component:
host, info, isDrawing, isStepping, onAttach, onDraw, onStep, tag
Method Summary
Method Attributes Method Name and Description
 
Returns the pixel position of the i'th character in the stored string.
 
Returns the bounding box dimensions of the rendered text in pixels.
Methods borrowed from class component:
canHandleEvent, draw, emitEvent, getKnownEvents, installEvent, installHandler, installHook, step, uninstallEvent, uninstallHandler, uninstallHook
Class Detail
text2d()
Component that can be used to draw high-quality text on-screen.
Field Detail
absolute
Whether the shape should be drawn using the absolute positions of its geometry. If absolute, node information is ignored.

color
Color of the text.

font
The font asset to use. See snadboxe.assets.load

fontSize
The size of the font, in "points"

mode
The rendering mode. See sandboxe.render2d.renderMode

node
The transform of the shape component.

spacingMode
See sandboxe.text2d.spacingMode

text
The Text to display.
Method Detail
{vector} getCharPosition(i)
Returns the pixel position of the i'th character in the stored string. Often, it is useful to get the extents of the the text that you wish to render. This will tell you at what pixel offset from the text2d node's position the character's top-left corner will be. The first character is always (0, 0).
Parameters:
{Number} i
The index of the character to get the position of.
Returns:
{vector} The position

{vector} getDimensions()
Returns the bounding box dimensions of the rendered text in pixels.
Returns:
{vector}

Documentation generated by JsDoc Toolkit 2.4.0 on Sun Feb 03 2019 18:30:57 GMT-0500 (EST)