|
VR-Engage
2.2
|
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>
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 DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () 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 | |
| DtVrvOverlay * | myOverlay |
| std::vector< Text > | myTexts |
| std::vector< makVrv::DtLineSegment * > | myLines |
| std::vector< makVrv::DtQuadProxy * > | myQuads |
| DtInitTable | myElementConfig |
Protected Attributes inherited from makVre::DtPlayerComponent | |
| std::string | myName |
| DtInitTable | myConfig |
| DtPlayerStation * | myPlayer |
| makVrv::DtDe * | myDe |
| DtEntityResolver * | myResolver |
| DtAttributeCallbackManager | myAttributeCallbacks |
| makVre::DtOverlayComponent::DtOverlayComponent | ( | ) |
Constructor for DtOverlayComponent.
Initializes the overlay component with the specified class name
|
overridevirtual |
Virtual destructor for DtOverlayComponent.
|
overridevirtual |
Initializes the overlay component.
| player | Pointer to the player station this component belongs to |
| config | Configuration table containing overlay settings and element definitions |
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().
|
overridevirtual |
Performs post-initialization after all components are initialized.
Resolves initial text values by substituting state attribute values
Reimplemented from makVre::DtPlayerComponent.
Reimplemented in makVre::DtMinimapUpdater.
|
overridevirtual |
Called every frame to update the overlay.
| dt | Delta time since the last frame in seconds |
Updates text elements with current state attribute values
Implements makVre::DtPlayerComponent.
Reimplemented in makVre::DtMinimapUpdater.
|
overridevirtual |
Shuts down the overlay component.
Destroys all created elements and the overlay itself
Reimplemented from makVre::DtPlayerComponent.
Reimplemented in makVre::DtMinimapUpdater.
|
virtual |
Finds a text element by its name.
| name | Name of the text element to find |
Searches through the text elements for one with the specified name
References makVre::DtPlayerComponent::name().
|
virtual |
Sets the visibility of a text element.
| name | Name of the text element to modify |
| isVisible | True to show the text, false to hide it |
Changes the visibility of a named text element by setting its group
References makVre::DtPlayerComponent::name().
|
virtual |
Sets the group for all overlay elements.
| group | Group 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)
|
overridevirtual |
Returns the component type identifier.
Implements makVre::DtPlayerComponent.
Reimplemented in makVre::DtMinimapUpdater.
|
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
|
protectedvirtual |
Converts a state attribute to a string representation.
| attrName | Name of the attribute to retrieve |
| mappings | Optional value mappings to translate numeric values to strings |
Retrieves a state attribute and converts it to a string, applying any mappings if provided
|
protectedvirtual |
Handles overlay resize events.
Called when the window or overlay is resized to rebuild all elements with the new screen dimensions
|
protectedvirtual |
Destroys all overlay elements.
Removes and deletes all text, line, and quad elements from the overlay
|
protectedvirtual |
Builds overlay elements from a configuration table.
| elements | Configuration table containing element definitions |
Creates text, line, and quad elements based on the provided configuration
Reimplemented in makVre::DtMinimapUpdater.
|
protected |
Pointer to the VRV overlay that contains all HUD elements.
|
protected |
Collection of text elements in the overlay.
|
protected |
Collection of line elements in the overlay.
|
protected |
Collection of quad elements in the overlay.
|
protected |
Configuration table containing element definitions.