NWengine 0.9
|
The Text class represents a text component that can be attached to a GameObject. More...
#include <Text.h>
Public Member Functions | |
Text ()=default | |
Text constructor. | |
~Text () | |
Text destructor. | |
Text (GameObject *go) | |
Text constructor with GameObject parameter. | |
void | Update () override |
Update is called every frame to update the Text component. | |
void * | GetGameObject () override |
GetGameObject returns the GameObject that the Text component is attached to. | |
void | SetGameObject (void *go) override |
SetGameObject sets the GameObject that the Text component is attached to. | |
void | UpdateGlyphs () |
UpdateGlyphs updates the glyphs of the Text component. | |
void | SetFont (const std::string &path, Shader *shader) |
SetFont sets the font of the Text component. | |
void | SetShader (Shader *shader) |
SetShader sets the shader of the Text component. | |
fVec2 | GetSize () |
Gets total size in pixels sets the shader of the text. | |
int | Serialize (std::fstream *data, int offset) override |
Serialize serializes the Text component data. | |
int | Deserialize (std::fstream *data, int offset) override |
Deserialize deserializes the Text component data. | |
Public Member Functions inherited from GameComponent | |
virtual void | Start () |
Start the game component. | |
virtual | ~GameComponent () |
Destructor for the game component. | |
Public Member Functions inherited from Serialized | |
Serialized () | |
Default constructor for Serialized class. | |
Static Public Member Functions | |
static std::string | GetType () |
GetType returns the type of the Text component. | |
Static Public Member Functions inherited from GameComponent | |
static std::string | GetType () |
Get the type of the game component. | |
Public Attributes | |
GameObject * | attachedObj = nullptr |
attachedObj is a pointer to the GameObject that the Text component is attached to. | |
std::list< Character > | characters |
characters is a list of characters that make up the text. | |
Shader * | _shader = nullptr |
_shader is a pointer to the shader used for rendering the text. | |
Font * | font = nullptr |
font is a pointer to the font used for rendering the text. | |
std::string | text = "" |
text is the string of text to be rendered. | |
bool | isBatched = true |
isBatched indicates whether the text is batched for rendering. | |
int | layerOrder = 0 |
layerOrder indicates the layer order of each glyph, changing this requires calling UpdateGlyph() | |
Vector4< float > | colors = Vector4<float>(1.0f, 1.0f, 1.0f, 1.0f) |
colors is the color of the text. | |
fVec2 | position = fVec2(0.0f, 0.0f) |
position is the position of the text. | |
fVec2 | scale = fVec2(1.0f, 1.0f) |
scale is the scale of the text. | |
The Text class represents a text component that can be attached to a GameObject.
Represents a text component that can be attached to a game object.
Text::Text | ( | GameObject * | go | ) |
Text constructor with GameObject parameter.
go | The GameObject to attach the Text component to. |
Deserialize deserializes the Text component data.
data | The file stream to read the serialized data from. |
offset | The offset in the file stream to start reading the serialized data. |
Reimplemented from Serialized.
|
overridevirtual |
GetGameObject returns the GameObject that the Text component is attached to.
Reimplemented from GameComponent.
fVec2 Text::GetSize | ( | ) |
Gets total size in pixels sets the shader of the text.
|
inlinestatic |
Serialize serializes the Text component data.
data | The file stream to write the serialized data to. |
offset | The offset in the file stream to start writing the serialized data. |
Reimplemented from Serialized.
SetFont sets the font of the Text component.
path | The path to the font file. |
shader | The shader to use for rendering the text. |
SetGameObject sets the GameObject that the Text component is attached to.
go | The GameObject to attach the Text component to. |
Reimplemented from GameComponent.
SetShader sets the shader of the Text component.
shader | The shader to use for rendering the text. |
|
overridevirtual |
Update is called every frame to update the Text component.
Reimplemented from GameComponent.