VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::HudItem Class Reference

Detailed Description

HudItem provides common functionality for all HUD elements, including positioning, alignment, visibility, and color. It also maintains a dirty flag system to track when properties have changed and rendering needs to be updated.

#include <hudItem.h>

Inheritance diagram for makVre::HudItem:
[legend]

Public Types

enum  Type { ILLEGAL_TYPE_UNDEFINED , TEXT , IMAGE }
 
enum  AlignHorizontal { LEFT , CENTER , RIGHT }
 
enum  AlignVertical { TOP , MIDDLE , BOTTOM }
 

Public Member Functions

 HudItem ()
 
virtual ~HudItem ()
 
virtual Type type () const
 
virtual int dirtyKey () const
 
virtual void makeDirty ()
 
virtual void getPosition (float *x, float *y) const
 
virtual void setPosition (float x, float y)
 
virtual AlignHorizontal getHorizontalAlignment () const
 
virtual void setHorizontalAlignment (AlignHorizontal align)
 
virtual AlignVertical getVerticalAlignment () const
 
virtual void setVerticalAlignment (AlignVertical align)
 
virtual float getX () const
 
virtual float getY () const
 
virtual bool getVisible () const
 
virtual void setVisible (bool visible)
 
virtual void getColor (float *r, float *g, float *b, float *a) const
 
virtual void setColor (float r, float g, float b, float a)
 
virtual float getRed () const
 
virtual float getGreen () const
 
virtual float getBlue () const
 
virtual float getAlpha () const
 

Protected Attributes

Type myType
 
int myDirtyKey
 
float myPosition [2]
 
AlignHorizontal myHorizontalAlignment
 
AlignVertical myVerticalAlignment
 
bool myVisible
 
float myColor [4]
 

Member Enumeration Documentation

◆ Type

Enumeration of supported HUD item types.

Enumerator
ILLEGAL_TYPE_UNDEFINED 

Invalid or uninitialized HUD item type.

TEXT 

Text-based HUD item.

IMAGE 

Image-based HUD item.

◆ AlignHorizontal

Horizontal alignment options for HUD items.

Enumerator
LEFT 

Align to the left edge.

CENTER 

Align to the horizontal center.

RIGHT 

Align to the right edge.

◆ AlignVertical

Vertical alignment options for HUD items.

Enumerator
TOP 

Align to the top edge.

MIDDLE 

Align to the vertical middle.

BOTTOM 

Align to the bottom edge.

Constructor & Destructor Documentation

◆ HudItem()

makVre::HudItem::HudItem ( )

Constructor for HudItem.

Initializes the item with default values: centered position (0.5, 0.5), white color (1,1,1,1), visibility enabled, and LEFT/TOP alignment

◆ ~HudItem()

virtual makVre::HudItem::~HudItem ( )
virtual

Virtual destructor for HudItem.

Member Function Documentation

◆ type()

virtual Type makVre::HudItem::type ( ) const
virtual

Gets the type of this HUD item.

Returns
The HUD item type (TEXT, IMAGE, etc.)

◆ dirtyKey()

virtual int makVre::HudItem::dirtyKey ( ) const
virtual

Gets the current dirty key value.

Returns
Integer representing the current dirty state

The dirty key is incremented whenever a property of the item is changed

◆ makeDirty()

virtual void makVre::HudItem::makeDirty ( )
virtual

Forces the item to be marked as dirty.

Marks the item as needing a redraw by significantly incrementing the dirty key

◆ getPosition()

virtual void makVre::HudItem::getPosition ( float * x,
float * y ) const
virtual

Gets the current position of the HUD item.

Parameters
xPointer to receive the x-coordinate (0.0 to 1.0)
yPointer to receive the y-coordinate (0.0 to 1.0)

Coordinates are in normalized screen space (0.0 to 1.0)

◆ setPosition()

virtual void makVre::HudItem::setPosition ( float x,
float y )
virtual

Sets the position of the HUD item.

Parameters
xThe x-coordinate in normalized screen space (0.0 to 1.0)
yThe y-coordinate in normalized screen space (0.0 to 1.0)

Updates the dirty key if the position changes

◆ getHorizontalAlignment()

virtual AlignHorizontal makVre::HudItem::getHorizontalAlignment ( ) const
virtual

Gets the current horizontal alignment.

Returns
The horizontal alignment value (LEFT, CENTER, or RIGHT)

◆ setHorizontalAlignment()

virtual void makVre::HudItem::setHorizontalAlignment ( AlignHorizontal align)
virtual

Sets the horizontal alignment.

Parameters
alignThe horizontal alignment to use

Updates the dirty key if the alignment changes

◆ getVerticalAlignment()

virtual AlignVertical makVre::HudItem::getVerticalAlignment ( ) const
virtual

Gets the current vertical alignment.

Returns
The vertical alignment value (TOP, MIDDLE, or BOTTOM)

◆ setVerticalAlignment()

virtual void makVre::HudItem::setVerticalAlignment ( AlignVertical align)
virtual

Sets the vertical alignment.

Parameters
alignThe vertical alignment to use

Updates the dirty key if the alignment changes

◆ getX()

virtual float makVre::HudItem::getX ( ) const
virtual

Gets the x-coordinate of the item's position.

Returns
The x-coordinate in normalized screen space (0.0 to 1.0)

◆ getY()

virtual float makVre::HudItem::getY ( ) const
virtual

Gets the y-coordinate of the item's position.

Returns
The y-coordinate in normalized screen space (0.0 to 1.0)

◆ getVisible()

virtual bool makVre::HudItem::getVisible ( ) const
virtual

Gets whether the HUD item is currently visible.

Returns
True if the item is visible, false otherwise

◆ setVisible()

virtual void makVre::HudItem::setVisible ( bool visible)
virtual

Sets the visibility of the HUD item.

Parameters
visibleTrue to make the item visible, false to hide it

Updates the dirty key if the visibility changes

◆ getColor()

virtual void makVre::HudItem::getColor ( float * r,
float * g,
float * b,
float * a ) const
virtual

Gets the current color of the HUD item.

Parameters
rPointer to receive the red component (0.0 to 1.0)
gPointer to receive the green component (0.0 to 1.0)
bPointer to receive the blue component (0.0 to 1.0)
aPointer to receive the alpha component (0.0 to 1.0)

◆ setColor()

virtual void makVre::HudItem::setColor ( float r,
float g,
float b,
float a )
virtual

Sets the color of the HUD item.

Parameters
rThe red component (0.0 to 1.0)
gThe green component (0.0 to 1.0)
bThe blue component (0.0 to 1.0)
aThe alpha component (0.0 to 1.0)

Updates the dirty key if the color changes

◆ getRed()

virtual float makVre::HudItem::getRed ( ) const
virtual

Gets the red component of the item's color.

Returns
The red component value (0.0 to 1.0)

◆ getGreen()

virtual float makVre::HudItem::getGreen ( ) const
virtual

Gets the green component of the item's color.

Returns
The green component value (0.0 to 1.0)

◆ getBlue()

virtual float makVre::HudItem::getBlue ( ) const
virtual

Gets the blue component of the item's color.

Returns
The blue component value (0.0 to 1.0)

◆ getAlpha()

virtual float makVre::HudItem::getAlpha ( ) const
virtual

Gets the alpha component of the item's color.

Returns
The alpha component value (0.0 to 1.0)

Member Data Documentation

◆ myType

Type makVre::HudItem::myType
protected

The type of this HUD item.

◆ myDirtyKey

int makVre::HudItem::myDirtyKey
protected

Key that tracks whether the item needs to be redrawn.

Incremented whenever a property changes that affects rendering

◆ myPosition

float makVre::HudItem::myPosition[2]
protected

Position of the item in normalized screen space [x, y].

◆ myHorizontalAlignment

AlignHorizontal makVre::HudItem::myHorizontalAlignment
protected

Horizontal alignment of the item.

◆ myVerticalAlignment

AlignVertical makVre::HudItem::myVerticalAlignment
protected

Vertical alignment of the item.

◆ myVisible

bool makVre::HudItem::myVisible
protected

Visibility flag for the item.

◆ myColor

float makVre::HudItem::myColor[4]
protected

Color of the item [r, g, b, a] with components in range 0.0 to 1.0.


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