40 Canvas(
int width = 1920,
int height = 1080);
55 void resize(
int width,
int height);
62 void add_element(std::shared_ptr<UIElement> element);
76 inline const std::vector<std::shared_ptr<UIElement>> &
get_elements()
const {
return m_elements; }
131 glm::mat4 m_projection;
134 std::vector<std::shared_ptr<UIElement>> m_elements;
137 bool m_visible =
true;
144 void update_projection();
151 void collect_render_items(std::vector<std::shared_ptr<UIElement>> &out_items);
159 void collect_element_recursive(
const std::shared_ptr<UIElement> element,
160 std::vector<std::shared_ptr<UIElement>> &out_items);
void set_visible(bool visible)
Set visibility of the entire canvas.
Definition canvas.hpp:114
void render()
Render all UI elements.
Definition canvas.cpp:36
~Canvas()=default
Destructor for Canvas.
void resize(int width, int height)
Resize the canvas to match window dimensions.
Definition canvas.cpp:15
const glm::mat4 & get_projection_matrix() const
Get the orthographic projection matrix.
Definition canvas.hpp:93
bool is_visible() const
Check if the canvas is visible.
Definition canvas.hpp:121
int get_height() const
Get the canvas height.
Definition canvas.hpp:107
Canvas(int width=1920, int height=1080)
Constructor for Canvas.
Definition canvas.cpp:13
void add_element(std::shared_ptr< UIElement > element)
Add a UI element to the canvas.
Definition canvas.cpp:21
int get_width() const
Get the canvas width.
Definition canvas.hpp:100
void remove_element(std::shared_ptr< UIElement > element)
Remove a UI element from the canvas.
Definition canvas.cpp:27
const std::vector< std::shared_ptr< UIElement > > & get_elements() const
Get all UI elements in the canvas.
Definition canvas.hpp:76
Forward declarations for Assimp Material structure.
Definition model_loader.cpp:12
Base class for all UI elements.