cangine
Loading...
Searching...
No Matches
panel_component.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "../../gameobjects/camera_object.hpp"
6#include "../quadrenderer_component.hpp"
7
12namespace cangine {
13 class Panel;
14
20
29 private:
30 std::vector<PanelChild*> children;
32 friend class Panel;
33
34 public:
35 float padding = 5;
36 float width = 350;
37 float height = 150;
38 Color color = Color(53, 53, 53, 1);
39
44 void registerChild(GameObject* childIn);
49 void registerChild(PanelChild* childIn);
50 void firstFrame() override;
51 void frame (double _dt) override;
52 void setRectColor(Color colorIn) override;
53 void setRectWidth(int widthIn) override;
54 void setRectHeight(int heightIn) override;
60 void setOffset(GameObject* gameobject, Vector3 offsetIn);
66 void setOffset(PanelChild* panelChild, Vector3 offsetIn);
86 };
87}
Base class for everything that lives in the scene.
Definition game_object.hpp:20
GameObject * gameObject
Owning game object.
Definition component.hpp:19
Container component that positions child objects relative to itself.
Definition panel_component.hpp:28
Vector3 pos
Panel position used as the offset origin.
Definition panel_component.hpp:31
~PanelComponent()
Definition panel_component.cpp:126
void setRectWidth(int widthIn) override
Sets the rectangle width.
Definition panel_component.cpp:102
float width
Panel width in pixels.
Definition panel_component.hpp:36
void setRectColor(Color colorIn) override
Sets the rectangle fill color.
Definition panel_component.cpp:98
void setOffset(GameObject *gameobject, Vector3 offsetIn)
Sets the offset for a child object.
Definition panel_component.cpp:110
void registerChild(GameObject *childIn)
Registers a child at a zero offset.
Definition panel_component.cpp:6
Vector3 getOffset(GameObject *go)
Returns a child's offset relative to the panel.
Definition panel_component.cpp:85
void setRectHeight(int heightIn) override
Sets the rectangle height.
Definition panel_component.cpp:106
std::vector< PanelChild * > children
Registered children and their offsets.
Definition panel_component.hpp:30
Vector3 getWorldPosition(GameObject *gameObject)
Computes a child's world position (panel position + offset).
Definition panel_component.cpp:76
float padding
Inner padding in pixels.
Definition panel_component.hpp:35
void firstFrame() override
Called once before the first frame update.
Definition panel_component.cpp:24
float height
Panel height in pixels.
Definition panel_component.hpp:37
PanelChild * getPanelObject(GameObject *gameObject)
Finds the child descriptor for a game object.
Definition panel_component.cpp:89
void frame(double _dt) override
Called every frame to update the component.
Definition panel_component.cpp:34
Color color
Panel background color.
Definition panel_component.hpp:38
Container game object that groups and positions child objects.
Definition panel_object.hpp:15
Component that draws its game object as a textured rectangle.
Definition quadrenderer_component.hpp:22
Definition audiomanager.cpp:4
RGBA color stored as normalized floating-point components.
Definition color.hpp:12
A child object of a panel together with its offset from the panel.
Definition panel_component.hpp:16
GameObject * go
The child game object.
Definition panel_component.hpp:17
Vector3 offset
Offset of the child relative to the panel's position.
Definition panel_component.hpp:18
Three-component floating-point vector.
Definition vector3.hpp:13