Container component that positions child objects relative to itself.
More...
#include <panel_component.hpp>
Container component that positions child objects relative to itself.
Draws a panel rectangle (via QuadRendererComponent) and keeps each registered child positioned at its stored offset, so moving the panel moves its children.
◆ ~PanelComponent()
| cangine::PanelComponent::~PanelComponent |
( |
| ) |
|
◆ firstFrame()
| void cangine::PanelComponent::firstFrame |
( |
| ) |
|
|
overridevirtual |
◆ frame()
| void cangine::PanelComponent::frame |
( |
double |
deltaTime | ) |
|
|
overridevirtual |
Called every frame to update the component.
- Parameters
-
| deltaTime | Seconds elapsed since the previous frame. |
Reimplemented from cangine::IComponent.
◆ getOffset()
Returns a child's offset relative to the panel.
- Parameters
-
- Returns
- The child's offset.
◆ getPanelObject()
Finds the child descriptor for a game object.
- Parameters
-
| gameObject | Object to look up. |
- Returns
- The matching PanelChild, or
nullptr if not a child.
◆ getWorldPosition()
Computes a child's world position (panel position + offset).
- Parameters
-
| gameObject | Child object to query. |
- Returns
- The child's world position.
◆ registerChild() [1/2]
| void cangine::PanelComponent::registerChild |
( |
GameObject * |
childIn | ) |
|
Registers a child at a zero offset.
- Parameters
-
| childIn | Child game object to add. |
◆ registerChild() [2/2]
| void cangine::PanelComponent::registerChild |
( |
PanelChild * |
childIn | ) |
|
Registers a child with a predefined offset.
- Parameters
-
| childIn | Child descriptor (object + offset) to add. |
◆ setOffset() [1/2]
| void cangine::PanelComponent::setOffset |
( |
GameObject * |
gameobject, |
|
|
Vector3 |
offsetIn |
|
) |
| |
Sets the offset for a child object.
- Parameters
-
| gameobject | Child object to reposition. |
| offsetIn | New offset relative to the panel. |
◆ setOffset() [2/2]
| void cangine::PanelComponent::setOffset |
( |
PanelChild * |
panelChild, |
|
|
Vector3 |
offsetIn |
|
) |
| |
Sets the offset for a child descriptor.
- Parameters
-
| panelChild | Child descriptor to reposition. |
| offsetIn | New offset relative to the panel. |
◆ setRectColor()
| void cangine::PanelComponent::setRectColor |
( |
Color |
colorIn | ) |
|
|
overridevirtual |
◆ setRectHeight()
| void cangine::PanelComponent::setRectHeight |
( |
int |
heightIn | ) |
|
|
overridevirtual |
◆ setRectWidth()
| void cangine::PanelComponent::setRectWidth |
( |
int |
widthIn | ) |
|
|
overridevirtual |
◆ Panel
◆ children
| std::vector<PanelChild*> cangine::PanelComponent::children |
|
private |
Registered children and their offsets.
◆ color
| Color cangine::PanelComponent::color = Color(53, 53, 53, 1) |
◆ height
| float cangine::PanelComponent::height = 150 |
◆ padding
| float cangine::PanelComponent::padding = 5 |
◆ pos
| Vector3 cangine::PanelComponent::pos |
|
private |
Panel position used as the offset origin.
◆ width
| float cangine::PanelComponent::width = 350 |
The documentation for this class was generated from the following files: