cubos::engine::UIElement struct

Component which defines the space an element of the UI occupies as a rect.

Public functions

auto bottomLeftCorner() const -> glm::vec2
Gets global position of the bottom left corner of the element.
auto topRightCorner() const -> glm::vec2
Gets global position of the top right corner of the element.
auto drawUntyped(const UIDrawList::Type& type, const core::gl::VertexArray& vertexArray, size_t vertexOffset, size_t vertexCount, const void* data) -> UIDrawList::EntryBuilder
Adds new entry to the draw list, with undefined data type.
template<typename T>
auto draw(const UIDrawList::Type& type, const core::gl::VertexArray& vertexArray, size_t vertexOffset, size_t vertexCount, const T& data) -> UIDrawList::EntryBuilder
Adds new entry to the draw list, with a defined data type.

Public variables

glm::vec2 offset
Offset of the pivot.
glm::vec2 size
Size of the element.
glm::vec2 pivot
Relative position of the pivot to the element itself.
glm::vec2 anchor
Relative position of the pivot to the parent element.
int layer
Rendering order layer.
glm::vec2 position
Global position of the pivot.
int hierarchyDepth
Depth in hierarchy. Used for depth sorting.
UIDrawList drawList
Draw list holding draw commands from this element.

Function documentation

glm::vec2 cubos::engine::UIElement::bottomLeftCorner() const

Gets global position of the bottom left corner of the element.

Returns Position value in global coordinates.

glm::vec2 cubos::engine::UIElement::topRightCorner() const

Gets global position of the top right corner of the element.

Returns Position value in global coordinates.

UIDrawList::EntryBuilder cubos::engine::UIElement::drawUntyped(const UIDrawList::Type& type, const core::gl::VertexArray& vertexArray, size_t vertexOffset, size_t vertexCount, const void* data)

Adds new entry to the draw list, with undefined data type.

Parameters
type Command type.
vertexArray Vertex array handle.
vertexOffset Index of the first vertex to be drawn.
vertexCount Number of vertexes to draw.
data Untyped command data.
Returns A builder for the created entry.

template<typename T>
UIDrawList::EntryBuilder cubos::engine::UIElement::draw(const UIDrawList::Type& type, const core::gl::VertexArray& vertexArray, size_t vertexOffset, size_t vertexCount, const T& data)

Adds new entry to the draw list, with a defined data type.

Template parameters
T Command data type.
Parameters
type Command type.
vertexArray Vertex array handle.
vertexOffset Index of the first vertex to be drawn.
vertexCount Number of vertexes to draw.
data Typed command data.
Returns A builder for the created entry.