|
cangine
|
Convenience game object that displays a line of text. More...
#include <label_object.hpp>


Public Member Functions | |
| Label (std::string text="Label", Vector3 position=Vector3(0, 0, 80)) | |
| Constructs a label. | |
| std::string | getText () |
| Returns the current text. | |
| Vector2 | getSize () |
| Returns the rendered size of the text. | |
| int | getFontHeight () |
| Returns the font pixel height. | |
| void | setText (std::string text) |
| Sets the displayed text. | |
| void | setFontHeight (int heightIn) |
| Sets the font pixel height. | |
| void | setColor (Color colorIn) |
| Sets the text color. | |
| void | setBackgroundColor (Color colorIn) |
| Sets the background color behind the text. | |
| TextRendererComponent * | getTextRendererComponent () |
| Returns the underlying text renderer component. | |
Public Member Functions inherited from cangine::GameObject | |
| GameObject () | |
| virtual | ~GameObject () |
| virtual void | onUpdate (double deltaTime) |
| Per-frame update hook. | |
| virtual void | onMouseEvent (const MouseEvent *e) |
| Mouse event hook. | |
| virtual void | onDisable () |
| Called when the object becomes inactive. | |
| virtual void | onEnable () |
| Called when the object becomes active. | |
| void | destroy () |
| Marks the object for destruction by the ObjectManager. | |
| template<typename T > | |
| void | appendComponent (T *component) |
| Attaches an existing component to this object. | |
| template<typename T > | |
| void | destroyComponent () |
| Destroys and removes the first component of a type. | |
| template<typename T > | |
| T * | getComponent () |
| Returns the first attached component of a type. | |
| template<typename T > | |
| std::vector< T * > | getComponents () |
| Returns all attached components of a type. | |
| template<typename T , typename... Args> | |
| T * | newComponent (Args &&... args) |
| Constructs a component in place and attaches it. | |
| void | setActive (bool a) |
| Activates or deactivates the object. | |
| bool | isActive () |
| Reports whether the object is active. | |
Private Attributes | |
| TextRendererComponent * | trc = nullptr |
| The underlying text renderer component. | |
Convenience game object that displays a line of text.
Wraps a TextRendererComponent so callers can create on-screen text without wiring up the component manually.
Constructs a label.
| text | Initial text to display. |
| position | Position of the label (z is the layer). |
| Vector2 cangine::Label::getSize | ( | ) |
Returns the rendered size of the text.
| std::string cangine::Label::getText | ( | ) |
Returns the current text.
| TextRendererComponent * cangine::Label::getTextRendererComponent | ( | ) |
Returns the underlying text renderer component.
Sets the background color behind the text.
| colorIn | New background color. |
Sets the text color.
| colorIn | New text color. |
Sets the font pixel height.
| heightIn | New font height in pixels. |
| void cangine::Label::setText | ( | std::string | text | ) |
Sets the displayed text.
| text | New text. |
|
private |
The underlying text renderer component.