Elaztek Developer Hub
Blamite Game Engine - blam!  00406.12.10.23.1457.blamite
The core library for the Blamite Game Engine.
BlamUIWidget Class Reference

Base class for a UI widget. More...

#include <ui.h>

+ Inheritance diagram for BlamUIWidget:
+ Collaboration diagram for BlamUIWidget:

Public Member Functions

 BlamUIWidget (BlamWidgetType type)
 Constructs a new UI widget. More...
 
 BlamUIWidget (BlamWidgetType type, BlamUIWidget_Group *_parent)
 Constructs a new UI widget. More...
 
virtual ~BlamUIWidget ()
 
virtual void Draw ()
 Draws the widget on-screen. More...
 
virtual void ShowImGuiPropertyEditor ()
 Displays an ImGUI-based property editor. More...
 
virtual void UpdateMetrics ()
 Updates metrics for the widget. More...
 
BlamWidgetType GetType ()
 Retrieves the type of this widget. More...
 
virtual void RefreshRelativePosition ()
 Updates the relative position of the widget, relative to its parent. More...
 
void RefreshRelativePosition (int viewport_width, int viewport_height, BlamVector2 initial_position)
 Updates the relative position of the widget. More...
 
void SetSize (BlamVector2 new_size)
 Sets the size of the widget. More...
 
virtual void SetPosition (BlamVector2 new_position)
 Sets the position of the widget. More...
 
void SetRotation (float new_rotation)
 Sets the rotation of the widget. More...
 
void SetAnchorPosition (BlamWidgetAnchor new_anchor_position)
 Sets the anchor position of the widget. More...
 
void MarkForUpdate ()
 Marks the widget as needing to be updated on the next draw call. More...
 
BlamVector2 GetAbsolutePosition ()
 Retrieves the absolute position of the widget. More...
 
BlamWidgetAnchor GetAnchorPosition ()
 Retrieves the anchor position of the widget. More...
 
virtual void SetHidden (bool new_hidden)
 Sets the hidden state of the widget. More...
 
bool IsHidden ()
 Checks whether or not the widget is hidden. More...
 

Public Attributes

std::string display_name = "unnamed"
 The display name of the widget. More...
 
std::string description = ""
 An optional description of the widget. More...
 
BlamVector2 position = { 0, 0 }
 The position of the widget, relative to its parent. More...
 
BlamVector2 size = { 100, 100 }
 The size of the widget, relative to its parent. More...
 
float rotation = 0.0f
 The rotation of the widget, in degrees. More...
 
int z_index = 0
 The Z index of the widget, where higher Z orders are drawn on top. More...
 
float z_size = 1.0f
 The Z size of the widget. Mostly unused. More...
 
bool auto_update = false
 Whether or not the widget should always update every frame. More...
 
Ogre::HlmsDatablock * material = nullptr
 The datablock used by the widget, if applicable. More...
 
BlamUIWidget_Groupparent = nullptr
 The parent group of this widget, if applicable. More...
 
bool ignore_layout = false
 Whether or not this widget should ignore any layout positioning. More...
 
bool hide_in_layout = false
 Whether or not this widget should be hidden within its layout. More...
 
bool ignore_scale_factor = false
 Whether or not this widget should ignore the UI scale factor settings. More...
 

Protected Member Functions

int GetAdjustedZIndex ()
 Retrieves the adjusted Z-index of the widget. More...
 

Protected Attributes

BlamVector2 position_absolute = { 0, 0 }
 The absolute position of the widget on-screen. More...
 
BlamVector2 size_absolute = { 100, 100 }
 The absolute size of the widget on-screen. More...
 
bool update = false
 Whether or not the widget needs to be updated before the next draw call. More...
 
bool hidden = false
 Whether or not the widget is hidden. More...
 

Detailed Description

Base class for a UI widget.

UI widgets allow for interactive and non-interactive elements to be displayed to the user, in 2D space.

Constructor & Destructor Documentation

◆ BlamUIWidget() [1/2]

BlamUIWidget::BlamUIWidget ( BlamWidgetType  type)

Constructs a new UI widget.

Parameters
type- The type of the new widget.
+ Here is the call graph for this function:

◆ BlamUIWidget() [2/2]

BlamUIWidget::BlamUIWidget ( BlamWidgetType  type,
BlamUIWidget_Group _parent 
)

Constructs a new UI widget.

Parameters
type- The type of the new widget.
_parent- The parent group of this widget.
+ Here is the call graph for this function:

◆ ~BlamUIWidget()

virtual BlamUIWidget::~BlamUIWidget ( )
inlinevirtual

Member Function Documentation

◆ Draw()

◆ GetAbsolutePosition()

BlamVector2 BlamUIWidget::GetAbsolutePosition ( )

Retrieves the absolute position of the widget.

Returns
The absolute position of the widget.
+ Here is the caller graph for this function:

◆ GetAdjustedZIndex()

int BlamUIWidget::GetAdjustedZIndex ( )
protected

Retrieves the adjusted Z-index of the widget.

This method converts the widget's Z-index property to the appropriate Z-depth for OGRE internal use. When changing the Z-index on a widget, the z_index property should be used instead.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAnchorPosition()

BlamWidgetAnchor BlamUIWidget::GetAnchorPosition ( )

Retrieves the anchor position of the widget.

Returns
The anchor position of the widget.
+ Here is the caller graph for this function:

◆ GetType()

BlamWidgetType BlamUIWidget::GetType ( )

Retrieves the type of this widget.

Returns
The type of this widget.
+ Here is the caller graph for this function:

◆ IsHidden()

bool BlamUIWidget::IsHidden ( )

Checks whether or not the widget is hidden.

Returns
true if the widget is hidden, otherwise returns false.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MarkForUpdate()

void BlamUIWidget::MarkForUpdate ( )

Marks the widget as needing to be updated on the next draw call.

+ Here is the caller graph for this function:

◆ RefreshRelativePosition() [1/2]

void BlamUIWidget::RefreshRelativePosition ( )
virtual

Updates the relative position of the widget, relative to its parent.

If the widget has no parent, then it will refresh relative to the viewport instead.

Reimplemented in BlamUIWidget_VLayoutGroup, BlamUIWidget_Group, BlamUIWidget_DebugMenu, BlamUIWidget_Console, BlamUIWidget_UserIDCypher, BlamUIWidget_CoordinatesDisplay, and BlamUIWidget_FramerateDisplay.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RefreshRelativePosition() [2/2]

void BlamUIWidget::RefreshRelativePosition ( int  viewport_width,
int  viewport_height,
BlamVector2  initial_position 
)

Updates the relative position of the widget.

Parameters
viewport_width- The width of the parent widget.
viewport_height- The height of the parent widget.
initial_position- The absolute position of the parent widget.
+ Here is the call graph for this function:

◆ SetAnchorPosition()

void BlamUIWidget::SetAnchorPosition ( BlamWidgetAnchor  new_anchor_position)

Sets the anchor position of the widget.

Parameters
new_anchor_position- The new anchor position of the widget.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetHidden()

void BlamUIWidget::SetHidden ( bool  new_hidden)
virtual

Sets the hidden state of the widget.

Parameters
new_hidden- Whether or not the widget should be hidden.

Reimplemented in BlamUIWidget_Text, BlamUIWidget_2DPrimitive, BlamUIWidget_Group, BlamUIWidget_DebugMenu, BlamUIWidget_DebugMenu_Item, and BlamUIWidget_CrashScreen.

+ Here is the caller graph for this function:

◆ SetPosition()

void BlamUIWidget::SetPosition ( BlamVector2  new_position)
virtual

Sets the position of the widget.

Parameters
new_position- The new position of the widget.

Reimplemented in BlamUIWidget_DebugMenu_Item.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetRotation()

void BlamUIWidget::SetRotation ( float  new_rotation)

Sets the rotation of the widget.

Parameters
new_rotation- The new rotation of the widget.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetSize()

void BlamUIWidget::SetSize ( BlamVector2  new_size)

Sets the size of the widget.

Parameters
new_size- The new size of the widget.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ShowImGuiPropertyEditor()

void BlamUIWidget::ShowImGuiPropertyEditor ( )
virtual

◆ UpdateMetrics()

virtual void BlamUIWidget::UpdateMetrics ( )
inlinevirtual

Updates metrics for the widget.

The term "metrics" as used in this method is generally up to an individual widget class to decide. However, in most cases, it will include position, size, rotation, and color.

Reimplemented in BlamUIWidget_Text, BlamUIWidget_2DPrimitive, BlamUIWidget_Group, BlamUIWidget_DebugMenu, BlamUIWidget_Console, BlamUIWidget_DebugMenu_Item, BlamUIWidget_UserIDCypher, BlamUIWidget_CoordinatesDisplay, and BlamUIWidget_FramerateDisplay.

+ Here is the caller graph for this function:

Member Data Documentation

◆ auto_update

bool BlamUIWidget::auto_update = false

Whether or not the widget should always update every frame.

◆ description

std::string BlamUIWidget::description = ""

An optional description of the widget.

◆ display_name

std::string BlamUIWidget::display_name = "unnamed"

The display name of the widget.

◆ hidden

bool BlamUIWidget::hidden = false
protected

Whether or not the widget is hidden.

◆ hide_in_layout

bool BlamUIWidget::hide_in_layout = false

Whether or not this widget should be hidden within its layout.

◆ ignore_layout

bool BlamUIWidget::ignore_layout = false

Whether or not this widget should ignore any layout positioning.

◆ ignore_scale_factor

bool BlamUIWidget::ignore_scale_factor = false

Whether or not this widget should ignore the UI scale factor settings.

◆ material

Ogre::HlmsDatablock* BlamUIWidget::material = nullptr

The datablock used by the widget, if applicable.

◆ parent

BlamUIWidget_Group* BlamUIWidget::parent = nullptr

The parent group of this widget, if applicable.

◆ position

BlamVector2 BlamUIWidget::position = { 0, 0 }

The position of the widget, relative to its parent.

◆ position_absolute

BlamVector2 BlamUIWidget::position_absolute = { 0, 0 }
protected

The absolute position of the widget on-screen.

◆ rotation

float BlamUIWidget::rotation = 0.0f

The rotation of the widget, in degrees.

◆ size

BlamVector2 BlamUIWidget::size = { 100, 100 }

The size of the widget, relative to its parent.

◆ size_absolute

BlamVector2 BlamUIWidget::size_absolute = { 100, 100 }
protected

The absolute size of the widget on-screen.

◆ update

bool BlamUIWidget::update = false
protected

Whether or not the widget needs to be updated before the next draw call.

◆ z_index

int BlamUIWidget::z_index = 0

The Z index of the widget, where higher Z orders are drawn on top.

◆ z_size

float BlamUIWidget::z_size = 1.0f

The Z size of the widget. Mostly unused.


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