![]() |
vkmEngine 1.0.15
A C++ game engine · vkmengine.com
|
The 2D rect of a UI node - the screen-space analogue of Transform. More...
#include <ui_element.h>
Static Public Member Functions | |
| static UIElement | at (const glm::vec2 &anchorPivot, const glm::vec2 &position, const glm::vec2 &size) |
| An element pinned to one normalised point of its parent by the matching point of itself. | |
Public Attributes | |
| glm::vec2 | anchor = {0.5f, 0.5f} |
| Parent anchor point, normalised (0,0 = top-left, 1,1 = bottom-right). | |
| glm::vec2 | pivot = {0.5f, 0.5f} |
| Element pivot, normalised; the point placed at the anchor. | |
| glm::vec2 | position = {0.0f, 0.0f} |
| glm::vec2 | size = {100.0f, 100.0f} |
| Element size, in canvas reference pixels, added to relativeSize's share. | |
| glm::vec2 | relativeSize = {0.0f, 0.0f} |
| The share of the parent's size this element takes, added to size. | |
| bool | visible = true |
| Skip this element and its whole subtree when false. | |
| float | opacity = 1.0f |
| How opaque this element and its whole subtree draw, 0 to 1: what a panel fades in and out by, without touching each colour under it. | |
| bool | blocksPointer = true |
| Whether this element stops a pointer reaching what is behind it. | |
| bool | clipChildren = false |
| Whether this element's rect bounds what its descendants may draw. | |
| UIRect | screenRect = {} |
| Resolved rect in screen pixels, written each frame. | |
The 2D rect of a UI node - the screen-space analogue of Transform.
The element's pivot point is pinned to its parent rect's anchor point (both normalised, top-left origin). position and size are in canvas reference pixels.
|
inlinestatic |
An element pinned to one normalised point of its parent by the matching point of itself.
| anchorPivot | Normalised point, 0..1 from the top-left, used as both. |
| position | Offset from the anchor, in canvas reference pixels. |
| size | Element size, in canvas reference pixels. |
| glm::vec2 Vkm::Engine::UIElement::position = {0.0f, 0.0f} |
Offset from the anchor, in canvas reference pixels.
| glm::vec2 Vkm::Engine::UIElement::relativeSize = {0.0f, 0.0f} |
The share of the parent's size this element takes, added to size.
(1, 1) with size (-40, -40) at a centred anchor is a 20 inset on every side. A resolved size below zero is zero.
| float Vkm::Engine::UIElement::opacity = 1.0f |
How opaque this element and its whole subtree draw, 0 to 1: what a panel fades in and out by, without touching each colour under it.
It multiplies down the tree, onto every colour's alpha. At nothing, the subtree is skipped as when not visible, and takes no clicks.
| bool Vkm::Engine::UIElement::blocksPointer = true |
| bool Vkm::Engine::UIElement::clipChildren = false |
Whether this element's rect bounds what its descendants may draw.
Off by default, since it costs a scissor change. Bounds the pointer as well as the pixels. A UIScroll clips whether or not this is set.