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

Detailed Description

DtOverlayComponent provides functionality for creating and managing 2D HUD elements including text, lines, and textured quads. The component can render these elements on top of the 3D scene and dynamically update text content based on state attributes. Elements are defined in the component's configuration and can be resized or repositioned when the display resolution changes.

#include <overlayComponent.h>

Inheritance diagram for makVre::DtOverlayComponent:
[legend]

Classes

struct  Text
 

Public Member Functions

 DtOverlayComponent ()
 
virtual ~DtOverlayComponent () override
 
virtual bool initialize (makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
 
virtual bool postInitialize () override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual makVrv::DtTextProxy * findTextByName (const std::string &name)
 
virtual void setTextVisible (const std::string &name, bool isVisible)
 
virtual void setAllElementGroups (int group)
 
virtual const char * type () const override
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Member Functions

virtual void resolveTexts ()
 
virtual std::string getAttributeAsString (const std::string &attrName, const std::vector< std::string > &mappings)
 
virtual void handleOverlayResized ()
 
virtual void destroyElements ()
 
virtual void buildElements (DtInitTable &elements)
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

DtVrvOverlaymyOverlay
 
std::vector< TextmyTexts
 
std::vector< makVrv::DtLineSegment * > myLines
 
std::vector< makVrv::DtQuadProxy * > myQuads
 
DtInitTable myElementConfig
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Constructor & Destructor Documentation

◆ DtOverlayComponent()

makVre::DtOverlayComponent::DtOverlayComponent ( )

Constructor for DtOverlayComponent.

Initializes the overlay component with the specified class name

◆ ~DtOverlayComponent()

virtual makVre::DtOverlayComponent::~DtOverlayComponent ( )
overridevirtual

Virtual destructor for DtOverlayComponent.

Member Function Documentation

◆ initialize()

virtual bool makVre::DtOverlayComponent::initialize ( makVre::DtPlayerStation * player,
makVre::DtInitTable & config )
overridevirtual

Initializes the overlay component.

Parameters
playerPointer to the player station this component belongs to
configConfiguration table containing overlay settings and element definitions
Returns
True if initialization succeeded, false otherwise

Creates the VRV overlay in the appropriate window/channel and builds the defined HUD elements from the configuration

Reimplemented from makVre::DtPlayerComponent.

Reimplemented in makVre::DtMinimapUpdater.

References makVre::DtPlayerComponent::player().

◆ postInitialize()

virtual bool makVre::DtOverlayComponent::postInitialize ( )
overridevirtual

Performs post-initialization after all components are initialized.

Returns
True if post-initialization succeeded, false otherwise

Resolves initial text values by substituting state attribute values

Reimplemented from makVre::DtPlayerComponent.

Reimplemented in makVre::DtMinimapUpdater.

◆ tick()

virtual void makVre::DtOverlayComponent::tick ( double dt)
overridevirtual

Called every frame to update the overlay.

Parameters
dtDelta time since the last frame in seconds

Updates text elements with current state attribute values

Implements makVre::DtPlayerComponent.

Reimplemented in makVre::DtMinimapUpdater.

◆ shutdown()

virtual void makVre::DtOverlayComponent::shutdown ( )
overridevirtual

Shuts down the overlay component.

Destroys all created elements and the overlay itself

Reimplemented from makVre::DtPlayerComponent.

Reimplemented in makVre::DtMinimapUpdater.

◆ findTextByName()

virtual makVrv::DtTextProxy * makVre::DtOverlayComponent::findTextByName ( const std::string & name)
virtual

Finds a text element by its name.

Parameters
nameName of the text element to find
Returns
Pointer to the text proxy if found, nullptr otherwise

Searches through the text elements for one with the specified name

References makVre::DtPlayerComponent::name().

◆ setTextVisible()

virtual void makVre::DtOverlayComponent::setTextVisible ( const std::string & name,
bool isVisible )
virtual

Sets the visibility of a text element.

Parameters
nameName of the text element to modify
isVisibleTrue to show the text, false to hide it

Changes the visibility of a named text element by setting its group

References makVre::DtPlayerComponent::name().

◆ setAllElementGroups()

virtual void makVre::DtOverlayComponent::setAllElementGroups ( int group)
virtual

Sets the group for all overlay elements.

Parameters
groupGroup number to assign to all elements

Changes the visibility group of all text, line, and quad elements (group 0 is typically used to hide elements, group 1 to show them)

◆ type()

virtual const char * makVre::DtOverlayComponent::type ( ) const
overridevirtual

Returns the component type identifier.

Returns
The component type string

Implements makVre::DtPlayerComponent.

Reimplemented in makVre::DtMinimapUpdater.

◆ resolveTexts()

virtual void makVre::DtOverlayComponent::resolveTexts ( )
protectedvirtual

Updates text elements with current state attribute values.

Processes all text strings, replacing state attribute references like with their current values from the player attribute store

◆ getAttributeAsString()

virtual std::string makVre::DtOverlayComponent::getAttributeAsString ( const std::string & attrName,
const std::vector< std::string > & mappings )
protectedvirtual

Converts a state attribute to a string representation.

Parameters
attrNameName of the attribute to retrieve
mappingsOptional value mappings to translate numeric values to strings
Returns
String representation of the attribute value

Retrieves a state attribute and converts it to a string, applying any mappings if provided

◆ handleOverlayResized()

virtual void makVre::DtOverlayComponent::handleOverlayResized ( )
protectedvirtual

Handles overlay resize events.

Called when the window or overlay is resized to rebuild all elements with the new screen dimensions

◆ destroyElements()

virtual void makVre::DtOverlayComponent::destroyElements ( )
protectedvirtual

Destroys all overlay elements.

Removes and deletes all text, line, and quad elements from the overlay

◆ buildElements()

virtual void makVre::DtOverlayComponent::buildElements ( DtInitTable & elements)
protectedvirtual

Builds overlay elements from a configuration table.

Parameters
elementsConfiguration table containing element definitions

Creates text, line, and quad elements based on the provided configuration

Reimplemented in makVre::DtMinimapUpdater.

Member Data Documentation

◆ myOverlay

DtVrvOverlay* makVre::DtOverlayComponent::myOverlay
protected

Pointer to the VRV overlay that contains all HUD elements.

◆ myTexts

std::vector<Text> makVre::DtOverlayComponent::myTexts
protected

Collection of text elements in the overlay.

◆ myLines

std::vector<makVrv::DtLineSegment*> makVre::DtOverlayComponent::myLines
protected

Collection of line elements in the overlay.

◆ myQuads

std::vector<makVrv::DtQuadProxy*> makVre::DtOverlayComponent::myQuads
protected

Collection of quad elements in the overlay.

◆ myElementConfig

DtInitTable makVre::DtOverlayComponent::myElementConfig
protected

Configuration table containing element definitions.


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