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

Base class for 2D primitive widgets. More...

#include <ui.h>

+ Inheritance diagram for BlamUIWidget_2DPrimitive:
+ Collaboration diagram for BlamUIWidget_2DPrimitive:

Classes

struct  Blam2DLine
 
struct  Blam2DTriangle
 
struct  Blam2DVertex
 

Public Member Functions

 BlamUIWidget_2DPrimitive (BlamWidgetType _type, BlamUIWidget_Group *_parent)
 Constructs a new 2D Primitive widget. More...
 
 ~BlamUIWidget_2DPrimitive ()
 
void Draw () override
 Draws the widget on-screen. More...
 
void ShowImGuiPropertyEditor () override
 Displays an ImGUI-based property editor. More...
 
void UpdateMetrics () override
 Updates metrics for the widget. More...
 
void SetHidden (bool new_hidden) override
 Sets the hidden state of the widget. More...
 
virtual void GenerateManualObject ()
 Virtual method used to generate the manual object. More...
 
- Public Member Functions inherited from BlamUIWidget
 BlamUIWidget (BlamWidgetType type)
 Constructs a new UI widget. More...
 
 BlamUIWidget (BlamWidgetType type, BlamUIWidget_Group *_parent)
 Constructs a new UI widget. More...
 
 BlamUIWidget (std::string type)
 Constructs a new UI widget. More...
 
 BlamUIWidget (std::string type, BlamUIWidget_Group *_parent)
 Constructs a new UI widget. More...
 
virtual ~BlamUIWidget ()
 
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...
 
bool IsMarkedForUpdate ()
 
void SetMarkedForUpdate (bool _update)
 
BlamVector2 GetAbsolutePosition ()
 Retrieves the absolute position of the widget. More...
 
BlamWidgetAnchor GetAnchorPosition ()
 Retrieves the anchor position of the widget. More...
 
bool IsHidden ()
 Checks whether or not the widget is hidden. More...
 
std::string GetCustomType ()
 Retrieves the custom type name of this widget. More...
 

Public Attributes

BlamColor color = BlamColor(255, 255, 255)
 The color of the widget. More...
 
- Public Attributes inherited from BlamUIWidget
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

void AddVertex (float x, float y, float z)
 
void AddTriangle (uint16_t x, uint16_t y, uint16_t z)
 
void AddLine (uint16_t x, uint16_t y)
 
- Protected Member Functions inherited from BlamUIWidget
int GetAdjustedZIndex ()
 Retrieves the adjusted Z-index of the widget. More...
 

Protected Attributes

bgfx::VertexLayout vertex_layout
 The vertex layout used for 2D primitives. More...
 
std::vector< Blam2DVertexvertices = std::vector<Blam2DVertex>()
 
std::vector< Blam2DTriangletriangles = std::vector<Blam2DTriangle>()
 
std::vector< Blam2DLinelines = std::vector<Blam2DLine>()
 
bgfx::VertexBufferHandle vertex_buffer = { bgfx::kInvalidHandle }
 
bgfx::IndexBufferHandle index_buffer = { bgfx::kInvalidHandle }
 
uint64_t state_flags = 0
 
Ogre::ManualObject * manual_object = nullptr
 The manual object associated with this widget. More...
 
Ogre::HlmsUnlitDatablock * datablock = nullptr
 The datablock associated with this widget. More...
 
Ogre::SceneNode * node = nullptr
 The scene node associated with this widget. More...
 
bool last_hide_state = false
 The last known hidden state. Used to automatically update the widget visibility. More...
 
bool needs_regen = true
 Whether or not the manual object needs to be regenerated. More...
 
- Protected Attributes inherited from BlamUIWidget
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...
 

Detailed Description

Base class for 2D primitive widgets.

This class acts as a base class for all types of 2D primitives, such as rectangles, ellipses, lines, and triangles.

Constructor & Destructor Documentation

◆ BlamUIWidget_2DPrimitive()

BlamUIWidget_2DPrimitive::BlamUIWidget_2DPrimitive ( BlamWidgetType  _type,
BlamUIWidget_Group _parent 
)

Constructs a new 2D Primitive widget.

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

◆ ~BlamUIWidget_2DPrimitive()

BlamUIWidget_2DPrimitive::~BlamUIWidget_2DPrimitive ( )
+ Here is the call graph for this function:

Member Function Documentation

◆ AddLine()

void BlamUIWidget_2DPrimitive::AddLine ( uint16_t  x,
uint16_t  y 
)
protected
+ Here is the caller graph for this function:

◆ AddTriangle()

void BlamUIWidget_2DPrimitive::AddTriangle ( uint16_t  x,
uint16_t  y,
uint16_t  z 
)
protected
+ Here is the caller graph for this function:

◆ AddVertex()

void BlamUIWidget_2DPrimitive::AddVertex ( float  x,
float  y,
float  z 
)
protected
+ Here is the caller graph for this function:

◆ Draw()

void BlamUIWidget_2DPrimitive::Draw ( )
overridevirtual

Draws the widget on-screen.

Reimplemented from BlamUIWidget.

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

◆ GenerateManualObject()

virtual void BlamUIWidget_2DPrimitive::GenerateManualObject ( )
inlinevirtual

Virtual method used to generate the manual object.

This method is overridden by any classes which inherit from this one, and is used to populate the vertices, triangles, and/or lines within the manual object as needed.

Reimplemented in BlamUIWidget_BasicLine, BlamUIWidget_BasicEllipse, and BlamUIWidget_BasicRectangle.

+ Here is the caller graph for this function:

◆ SetHidden()

void BlamUIWidget_2DPrimitive::SetHidden ( bool  new_hidden)
overridevirtual

Sets the hidden state of the widget.

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

Reimplemented from BlamUIWidget.

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

◆ ShowImGuiPropertyEditor()

void BlamUIWidget_2DPrimitive::ShowImGuiPropertyEditor ( )
overridevirtual

Displays an ImGUI-based property editor.

Used in conjunction with the UI Editor window.

Reimplemented from BlamUIWidget.

Reimplemented in BlamUIWidget_BasicTriangle, BlamUIWidget_BasicLine, BlamUIWidget_BasicEllipse, and BlamUIWidget_BasicRectangle.

+ Here is the call graph for this function:

◆ UpdateMetrics()

void BlamUIWidget_2DPrimitive::UpdateMetrics ( )
overridevirtual

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.

Note
This should NOT be called from threads besides the rendering thread. To update metrics from other threads, use MarkForUpdate.

Reimplemented from BlamUIWidget.

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

Member Data Documentation

◆ color

BlamColor BlamUIWidget_2DPrimitive::color = BlamColor(255, 255, 255)

The color of the widget.

◆ datablock

Ogre::HlmsUnlitDatablock* BlamUIWidget_2DPrimitive::datablock = nullptr
protected

The datablock associated with this widget.

◆ index_buffer

bgfx::IndexBufferHandle BlamUIWidget_2DPrimitive::index_buffer = { bgfx::kInvalidHandle }
protected

◆ last_hide_state

bool BlamUIWidget_2DPrimitive::last_hide_state = false
protected

The last known hidden state. Used to automatically update the widget visibility.

◆ lines

std::vector<Blam2DLine> BlamUIWidget_2DPrimitive::lines = std::vector<Blam2DLine>()
protected

◆ manual_object

Ogre::ManualObject* BlamUIWidget_2DPrimitive::manual_object = nullptr
protected

The manual object associated with this widget.

◆ needs_regen

bool BlamUIWidget_2DPrimitive::needs_regen = true
protected

Whether or not the manual object needs to be regenerated.

◆ node

Ogre::SceneNode* BlamUIWidget_2DPrimitive::node = nullptr
protected

The scene node associated with this widget.

◆ state_flags

uint64_t BlamUIWidget_2DPrimitive::state_flags = 0
protected

◆ triangles

std::vector<Blam2DTriangle> BlamUIWidget_2DPrimitive::triangles = std::vector<Blam2DTriangle>()
protected

◆ vertex_buffer

bgfx::VertexBufferHandle BlamUIWidget_2DPrimitive::vertex_buffer = { bgfx::kInvalidHandle }
protected

◆ vertex_layout

bgfx::VertexLayout BlamUIWidget_2DPrimitive::vertex_layout
protected

The vertex layout used for 2D primitives.

◆ vertices

std::vector<Blam2DVertex> BlamUIWidget_2DPrimitive::vertices = std::vector<Blam2DVertex>()
protected

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