|
| UIElement (std::string name) |
| Default Constructor.
|
|
| ~UIElement () override |
|
void | Init () override |
| Creates the UI element and adds it to the DOM.
|
|
void | AddTheme (const char *theme) |
| Sets the theme of the UI element.
|
|
void | SetAnchor (const char *anchor) |
| Sets the anchor of the UI element.
|
|
void | SetDimensions (Vec2f dimensions) |
| Sets the dimensions of the UI element.
|
|
void | SetOffset (Vec2f offset) |
| Sets the offset of the UI element.
|
|
void | OnEnable () override |
| Shows the UI element when enabled.
|
|
void | OnDisable () override |
| Hides the UI element when disabled.
|
|
| Node (std::string name) |
| Default constructor.
|
|
virtual | ~Node () |
| Default destructor.
|
|
size_t | AddChild (Node *child) |
| Adds a child to the node and assigns itself as the parent of the new node.
|
|
Node * | GetChild (size_t index) |
| Returns a reference to the child at the specified index.
|
|
Success | RemoveChild (size_t index) |
| Removes the child at the specified index.
|
|
Success | SetEnabled (bool enabled=true) |
| Toggles the state of the node.
|
|
virtual void | Draw () |
| Overridable draw method for the node.
|
|
virtual void | Update (float dt) |
| Overridable update method for the node.
|
|
Base class for UI elements.
Uses the Node class to create an element in the DOM. Although this is considered an abstract class, you by freely use it as a container for UI Elements.
- Author
- Roberto Selles
void Engine::UI::UIElement::SetAnchor |
( |
const char * |
anchor | ) |
|
Sets the anchor of the UI element.
By default, the element is placed in the top left, but you can set to anchor any of the following:
- "topright"
- "bottomleft"
- "bottomright"
- "center"
If you do anchor the element to a centered position, the offset will assume to translate either to the bottom or right of the anchor. (depending on the axis that has been centered)
- Warning
- This should only be called once per UI element
- Parameters
-
anchor | The anchor as a string |