Crafter.Graphics
C++ graphics library using Wayland and Vulkan.
 
Loading...
Searching...
No Matches
Crafter::UiElement Class Referenceexport

General use UiElement for handeling input events. Add to a window's elements member to start recieving events. More...

Public Member Functions

 UiElement (float anchorX, float anchorY, std::uint32_t bufferWidth, std::uint32_t bufferHeight, std::uint32_t absoluteWidth, std::uint32_t absoluteHeight, float anchorOffsetX=0.5, float anchorOffsetY=0.5, float z=0, bool ignoreScaling=false)
 Constructs a UiElement with absolute dimensions.
 
 UiElement (float anchorX, float anchorY, std::uint32_t bufferWidth, std::uint32_t bufferHeight, float relativeWidth, float relativeHeight, float anchorOffsetX=0.5, float anchorOffsetY=0.5, float z=0, bool ignoreScaling=false)
 Constructs a UiElement with relative dimensions.
 

Public Attributes

Event< MouseMoveEvent > onMouseMove
 
Event< MouseMoveEvent > onMouseEnter
 
Event< MouseMoveEvent > onMouseLeave
 
Event< MousePoint > onMouseRightClick
 
Event< MousePoint > onMouseLeftClick
 
Event< MousePoint > onMouseRightHold
 
Event< MousePoint > onMouseLeftHold
 
Event< MousePoint > onMouseRightRelease
 
Event< MousePoint > onMouseLeftRelease
 
float z
 
float anchorX
 
float anchorY
 
bool useRelativeSize
 
bool ignoreScaling
 
std::uint32_t bufferWidth
 
std::uint32_t bufferHeight
 
std::uint32_t absoluteWidth
 
std::uint32_t absoluteHeight
 
float relativeWidth
 
float relativeHeight
 
float anchorOffsetX
 
float anchorOffsetY
 
std::vector< Pixel_BU8_GU8_RU8_AU8 > buffer
 
std::vector< UiElementchildren
 

Detailed Description

General use UiElement for handeling input events. Add to a window's elements member to start recieving events.

Constructor & Destructor Documentation

◆ UiElement() [1/2]

Crafter::UiElement::UiElement ( float anchorX,
float anchorY,
std::uint32_t bufferWidth,
std::uint32_t bufferHeight,
std::uint32_t absoluteWidth,
std::uint32_t absoluteHeight,
float anchorOffsetX = 0.5,
float anchorOffsetY = 0.5,
float z = 0,
bool ignoreScaling = false )

Constructs a UiElement with absolute dimensions.

Parameters
anchorXRelative position where this elements x anchor (top-left) is placed to its parent x anchor
anchorYRelative position where this elements y anchor (top-left) is placed to its parent y anchor
bufferWidthThe width of this elements pixel buffer
bufferHeightThe height of this elements pixel buffer
absoluteWidthThe absolute x size in pixels this element should be scaled to
absoluteHeightThe absolute y size in pixels this element should be scaled to
anchorOffsetXThe amount this element's anchor should be offset from the top left corner (0.5 to in the middle)
anchorOffsetYThe amount this element's anchor should be offset from the top left corner (0.5 to place it in the middle)
zThis elements Z position
ignoreScalingWether this element ignores the scaling of the window, if true its size will be scaled according to the window scale

◆ UiElement() [2/2]

Crafter::UiElement::UiElement ( float anchorX,
float anchorY,
std::uint32_t bufferWidth,
std::uint32_t bufferHeight,
float relativeWidth,
float relativeHeight,
float anchorOffsetX = 0.5,
float anchorOffsetY = 0.5,
float z = 0,
bool ignoreScaling = false )

Constructs a UiElement with relative dimensions.

Parameters
anchorXRelative position where this elements x anchor (top-left) is placed to its parent x anchor
anchorYRelative position where this elements y anchor (top-left) is placed to its parent y anchor
bufferWidthThe width of this elements pixel buffer
bufferHeightThe height of this elements pixel buffer
relativeWidthThe relative x size this element should be scaled to compared to its parent
relativeHeightThe relative y size this element should be scaled to compared to its parent
anchorOffsetXThe amount this element's anchor should be offset from the top left corner (0.5 to in the middle)
anchorOffsetYThe amount this element's anchor should be offset from the top left corner (0.5 to place it in the middle)
zThis elements Z position
ignoreScalingWether this element ignores the scaling of the window, if true its size will be scaled according to the window scale

The documentation for this class was generated from the following file: