Text Object allow you to add either static or dynamic string to a Scene. It can be used in 2d to display dialogs or subtitles, graphical user interface; or in 3d to display interactive information in real time using perspective.
The text basically, act like a regular Object and can be manipulated and parented the same way as any other Object data type; which makes them easy to use and convenient.
See Also
Static Variables
Name | Description |
object | Parent Object where the Texture component is maintained. |
Declaration
|
texture | Current Font Texture connected to the active Text. |
Declaration
|
size | Active width and height of the Text in pixels (based on the size of the connected Font). |
Declaration
|
Variables
Name | Description |
string | Active string the Text Object is displaying. |
Declaration
|
justify | Controls the alignment of the Text Object pivot. |
Declaration
|
double_sided | Determine if face culling should be turned on (false ) or off (true ). |
Declaration
|
display_count | The number of characters that should be draw when rendering the active Text. |
Declaration - Note
- The default value of
-1 (or any negative value) represent that the full string should be displayed when drawing the Text Object.
|
Functions
Name | Description |
SetTexture | Connect an existing Font Texture Asset to the active Text. |
Declaration bool SetTexture( Texture *texture ) Parameters
Return Value
true if the Texture can be connected to the Text; else return false if the TextureType is not kFont .
|
SetMaterial | Assign an existing Material to the current Text. |
Declaration void SetMaterial( int renderlayer_cap, Material *material ) Parameters
renderlayer_cap : Specify the cap of an existing RenderLayer to draw the Material too.
material : Reference to an existing Material; to disconnect the Asset pass nil .
|
CopyMaterials | Copy the current Material settings from a RenderLayer to another. |
Declaration bool CopyMaterials( int from_renderlayer_cap, int to_renderlayer_cap ) Parameters
from_renderlayer_cap : The RenderLayer slot to copy.
to_renderlayer_cap : An existing RenderLayer cap to copy to.
Return Value
true on success; false if the lod_index is invalid or if the from_renderlayer_cap does not exist.
|
GetMaterial | Retrieve the Material assigned to a specific slot settings. |
Declaration Material *GetMaterial( int renderlayer_cap ) Parameters
renderlayer_cap : The RenderLayer cap assigned to the slot.
Return Value
A Material reference; nil if no slot match the parameters or if the slot does not have any Material connected to it.
|
SetCharOffset | Assign an offset on the X and Y axis to a specific character. |
Declaration bool SetCharOffset( const unsigned int index, const vec2 offset ) Parameters
index : Index of the character to edit.
offset : The offset on the X and Y axis.
Return Value
true on success; false if the index specified does not correspond to any character index of the current Text string value.
|
SetCharColor | Assign a specific RGBA value to a specific character. |
Declaration bool SetCharColor( const unsigned int index, const vec4 color ) Parameters
index : Index of the character to edit.
color : The RGBA value to assign as vertex color to the character specified by index .
Return Value
true on success; false if the index specified is outside of the range of the current Text string value.
|
Events
Callbacks | Description |
OnDraw | Triggered each time the Text is about to be sent to GPU for drawing. |
Declaration
|
OnDisplay | This callback is activated right after the Text drawcall have been sent to GPU. |
Declaration
|
Justify
Enumeration of the Text pivot alignment.
kLeft
: Offset the Text to the left side of the Object pivot.
kRight
: Offset the Text to the right side of the Object pivot.
kCentered
: Center the Text around the Object pivot.