|
VR-Engage
2.2
|
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>
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] |
| 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
|
virtual |
Virtual destructor for HudItem.
|
virtual |
Gets the type of this HUD item.
|
virtual |
Gets the current dirty key value.
The dirty key is incremented whenever a property of the item is changed
|
virtual |
Forces the item to be marked as dirty.
Marks the item as needing a redraw by significantly incrementing the dirty key
|
virtual |
Gets the current position of the HUD item.
| x | Pointer to receive the x-coordinate (0.0 to 1.0) |
| y | Pointer to receive the y-coordinate (0.0 to 1.0) |
Coordinates are in normalized screen space (0.0 to 1.0)
|
virtual |
Sets the position of the HUD item.
| x | The x-coordinate in normalized screen space (0.0 to 1.0) |
| y | The y-coordinate in normalized screen space (0.0 to 1.0) |
Updates the dirty key if the position changes
|
virtual |
Gets the current horizontal alignment.
|
virtual |
Sets the horizontal alignment.
| align | The horizontal alignment to use |
Updates the dirty key if the alignment changes
|
virtual |
Gets the current vertical alignment.
|
virtual |
Sets the vertical alignment.
| align | The vertical alignment to use |
Updates the dirty key if the alignment changes
|
virtual |
Gets the x-coordinate of the item's position.
|
virtual |
Gets the y-coordinate of the item's position.
|
virtual |
Gets whether the HUD item is currently visible.
|
virtual |
Sets the visibility of the HUD item.
| visible | True to make the item visible, false to hide it |
Updates the dirty key if the visibility changes
|
virtual |
Gets the current color of the HUD item.
| r | Pointer to receive the red component (0.0 to 1.0) |
| g | Pointer to receive the green component (0.0 to 1.0) |
| b | Pointer to receive the blue component (0.0 to 1.0) |
| a | Pointer to receive the alpha component (0.0 to 1.0) |
|
virtual |
Sets the color of the HUD item.
| r | The red component (0.0 to 1.0) |
| g | The green component (0.0 to 1.0) |
| b | The blue component (0.0 to 1.0) |
| a | The alpha component (0.0 to 1.0) |
Updates the dirty key if the color changes
|
virtual |
Gets the red component of the item's color.
|
virtual |
Gets the green component of the item's color.
|
virtual |
Gets the blue component of the item's color.
|
virtual |
Gets the alpha component of the item's color.
|
protected |
The type of this HUD item.
|
protected |
Key that tracks whether the item needs to be redrawn.
Incremented whenever a property changes that affects rendering
|
protected |
Position of the item in normalized screen space [x, y].
|
protected |
Horizontal alignment of the item.
|
protected |
Vertical alignment of the item.
|
protected |
Visibility flag for the item.
|
protected |
Color of the item [r, g, b, a] with components in range 0.0 to 1.0.