|
cangine
|
Container game object that groups and positions child objects. More...
#include <panel_object.hpp>


Public Member Functions | |
| Panel (int padding=5) | |
| Constructs a panel. | |
| void | onDisable () override |
| Called when the object becomes inactive. | |
| void | onEnable () override |
| Called when the object becomes active. | |
| void | setPadding (int paddingIn) |
| Sets the inner padding. | |
| void | registerChild (GameObject *childIn) |
| Adds a child object to the panel. | |
| void | setRectColor (Color colorIn) |
| Sets the panel background color. | |
| void | setRectWidth (int widthIn) |
| Sets the panel width. | |
| void | setRectHeight (int heightIn) |
| Sets the panel height. | |
| void | setOffset (GameObject *go, Vector3 offset) |
| Sets a child's offset relative to the panel. | |
| Vector3 | getOffset (GameObject *go) |
| Returns a child's offset relative to the panel. | |
| Vector2 | getRectSize () |
| Returns the panel's size. | |
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. | |
| 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 | |
| PanelComponent * | pc = nullptr |
| Component implementing panel layout. | |
| std::unordered_set< PanelChild * > | notActive |
| Children that were inactive before the panel was disabled. | |
Container game object that groups and positions child objects.
Backed by a PanelComponent: children are placed relative to the panel, and enabling/disabling the panel cascades to its children.
| cangine::Panel::Panel | ( | int | padding = 5 | ) |
Constructs a panel.
| padding | Inner padding in pixels. |
| Vector3 cangine::Panel::getOffset | ( | GameObject * | go | ) |
Returns a child's offset relative to the panel.
| go | Child object to query. |
| Vector2 cangine::Panel::getRectSize | ( | ) |
Returns the panel's size.
|
overridevirtual |
Called when the object becomes inactive.
Reimplemented from cangine::GameObject.
|
overridevirtual |
Called when the object becomes active.
Reimplemented from cangine::GameObject.
| void cangine::Panel::registerChild | ( | GameObject * | childIn | ) |
Adds a child object to the panel.
| childIn | Child game object to add. |
| void cangine::Panel::setOffset | ( | GameObject * | go, |
| Vector3 | offset | ||
| ) |
Sets a child's offset relative to the panel.
| go | Child object to reposition. |
| offset | New offset. |
Sets the inner padding.
| paddingIn | New padding in pixels. |
Sets the panel background color.
| colorIn | New color. |
Sets the panel height.
| heightIn | New height in pixels. |
Sets the panel width.
| widthIn | New width in pixels. |
|
private |
Children that were inactive before the panel was disabled.
|
private |
Component implementing panel layout.