cangine
Loading...
Searching...
No Matches
panel_object.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <unordered_set>
4
5#include "../game_object.hpp"
6#include "../../components/ui/panel_component.hpp"
7
8namespace cangine {
15 class Panel : public GameObject {
16 private:
17 PanelComponent* pc = nullptr;
18 std::unordered_set<PanelChild*> notActive;
19
20 public:
25 Panel(int padding = 5);
26 void onDisable() override;
27 void onEnable() override;
32 void setPadding(int paddingIn);
47 void setRectWidth(int widthIn);
52 void setRectHeight(int heightIn);
58 void setOffset(GameObject* go, Vector3 offset);
59
71 };
72}
Base class for everything that lives in the scene.
Definition game_object.hpp:20
T * getComponent()
Returns the first attached component of a type.
Definition game_object.hpp:93
Container component that positions child objects relative to itself.
Definition panel_component.hpp:28
Container game object that groups and positions child objects.
Definition panel_object.hpp:15
PanelComponent * pc
Component implementing panel layout.
Definition panel_object.hpp:17
void registerChild(GameObject *childIn)
Adds a child object to the panel.
Definition panel_object.cpp:14
void setOffset(GameObject *go, Vector3 offset)
Sets a child's offset relative to the panel.
Definition panel_object.cpp:30
void setRectHeight(int heightIn)
Sets the panel height.
Definition panel_object.cpp:26
void setPadding(int paddingIn)
Sets the inner padding.
Definition panel_object.cpp:10
std::unordered_set< PanelChild * > notActive
Children that were inactive before the panel was disabled.
Definition panel_object.hpp:18
Vector2 getRectSize()
Returns the panel's size.
Definition panel_object.cpp:38
void onEnable() override
Called when the object becomes active.
Definition panel_object.cpp:52
Vector3 getOffset(GameObject *go)
Returns a child's offset relative to the panel.
Definition panel_object.cpp:34
void setRectColor(Color colorIn)
Sets the panel background color.
Definition panel_object.cpp:18
void setRectWidth(int widthIn)
Sets the panel width.
Definition panel_object.cpp:22
void onDisable() override
Called when the object becomes inactive.
Definition panel_object.cpp:42
Definition audiomanager.cpp:4
RGBA color stored as normalized floating-point components.
Definition color.hpp:12
Two-component floating-point vector.
Definition vector2.hpp:13
Three-component floating-point vector.
Definition vector3.hpp:13