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

Detailed Description

DtMenu provides the foundation for all menus in VR-Engage. It manages a collection of menu elements, handles selection state, scrolling, input processing, and visual presentation. The menu system supports various types including static menus, quick context-sensitive menus, and specialized input menus.

Menus can be hierarchical, with parent-child relationships, and support both keyboard/mouse and VR controller input. They can dynamically update their content based on player state and context.

#include <actionMenu.h>

Inheritance diagram for makVre::DtMenu:
[legend]

Classes

struct  Item
 

Public Types

enum  Type { STATIC , QUICK }
 

Public Member Functions

 DtMenu (DtMenuManager &mgr)
 
virtual ~DtMenu ()
 
virtual const std::string & name ()
 
virtual void setName (const std::string &name)
 
virtual void setPosition (float x, float y)
 
virtual float x () const
 
virtual float y () const
 
virtual void setSize (float x, float y)
 
virtual float width () const
 
virtual float height () const
 
virtual void setActive (bool active, bool saveSelection=false, bool closeOnElementSelected=false)
 
virtual bool isActive () const
 
virtual bool isEmpty () const
 
virtual void tick (double dt)
 
virtual void activateInputLogic ()
 
virtual void deactivateInputLogic ()
 
virtual const std::string & title () const
 
virtual void setTitle (const std::string &title)
 
virtual const std::string & titleAttribute () const
 
void setTitleAttribute (const std::string &titleAttribute)
 
virtual void setShowTitle (bool show)
 
virtual void addElement (DtMenuElement *element)
 
virtual DtMenuElementremoveElement (DtMenuElement *element)
 
virtual DtMenuElementremoveElement (const std::string &name)
 
virtual DtMenuElementfindElement (const std::string &name)
 
virtual std::vector< DtMenuElement * > elements ()
 
virtual bool selectElement (int index)
 
virtual void selectElementByOnScreenIndex (int index)
 
virtual bool selectElement (const std::string &name)
 
virtual void selectNext (float val=1)
 
virtual void selectPrevious (float val=1)
 
virtual DtMenuElementselectedElement ()
 
virtual int selectedElementIndex () const
 
virtual void clearSelected ()
 
virtual bool scrollToItem (int index)
 
virtual void scrollDown ()
 
virtual void scrollUp ()
 
virtual void scroll (float val)
 
virtual void pageUp (float val=1)
 
virtual void pageDown (float val=1)
 
virtual void updateElements ()
 
virtual void updateVisuals ()
 
virtual void addElementGenerator (DtMenuAttributeObserver *generator)
 
virtual void setParent (const std::string &name)
 
virtual void setInheritParentPosition (bool set)
 
virtual void setInheritParentSize (bool set)
 
virtual const std::string & parent () const
 
virtual void closeMenu (float val=1)
 
virtual void select (float val=1)
 
virtual void selectItem (float val, unsigned int num)
 
virtual void select1 (float val)
 
virtual void select2 (float val)
 
virtual void select3 (float val)
 
virtual void select4 (float val)
 
virtual void select5 (float val)
 
virtual void select6 (float val)
 
virtual void select7 (float val)
 
virtual void select8 (float val)
 
virtual void select9 (float val)
 
virtual void select10 (float val)
 
virtual void back (float val=1)
 
virtual const DtMenuDisplayConditionsdisplayConditions () const
 
virtual DtMenuDisplayConditionsdisplayConditions ()
 
virtual bool containsEnabledDuplicate (DtMenuElement *element)
 
virtual DtMenuManagermanager ()
 
void setType (Type type)
 
Type type ()
 
virtual void clearElements ()
 
void triggerActionFromQML (int index)
 

Protected Types

enum  Layers { HIDDEN , BACKGROUND , GRAPHIC , LABEL }
 

Protected Member Functions

virtual DtVreMessageResult handlePlayerControlsState (DtVreMessage *msg)
 
virtual DtVreMessageResult handleMenuInputMessage (DtVreMessage *msg)
 
virtual bool scrollToItem (int index, bool doUpdate)
 
virtual void updateImguiUI ()
 

Protected Attributes

DtMenuManagermyManager
 
std::string myName
 
std::string myTitleString
 
std::string myTitleAttribute
 
std::string myParent
 
DtMenuDisplayConditions myDisplayConditions
 
Type myType
 
float myX
 
float myY
 
float myWidth
 
float myHeight
 
bool myIsActive
 
bool myShowTitle
 
bool myNeedParentSize
 
bool myNeedParentPosition
 
bool myShouldShowNumbers
 
std::vector< Item * > myItems
 
std::vector< Item * > myEnabledItems
 
ItemmySelectedItem
 
ItemmySavedSelection
 
Item myScrollUp
 
Item myScrollDown
 
bool myCanScrollUp
 
bool myCanScrollDown
 
int myScrollOffset
 
int myVisibleScrollItems
 
double myActionFlash
 
bool myCloseOnSelection
 
int myLineHeight
 
DtMenuAttributeObservermyElementGenerator
 
DtInputLogic myInputLogic
 

Member Enumeration Documentation

◆ Type

Menu type enumeration.

Defines the types of menus supported by the system:

  • STATIC: Standard menu that persists until explicitly closed
  • QUICK: Context-sensitive menu that appears temporarily based on proximity or other triggers
Enumerator
STATIC 

Standard persistent menu.

QUICK 

Context-sensitive temporary menu.

◆ Layers

enum makVre::DtMenu::Layers
protected

Enumeration of display layers for menu rendering.

Defines the different visual layers used when rendering the menu, with later layers drawn on top of earlier ones. This allows proper layering of menu components for a cohesive visual appearance.

Enumerator
HIDDEN 

Layer for hidden elements (not displayed)

BACKGROUND 

Background layer (drawn first)

GRAPHIC 

Graphic elements layer (drawn second)

LABEL 

Text labels layer (drawn on top)

Constructor & Destructor Documentation

◆ DtMenu()

makVre::DtMenu::DtMenu ( DtMenuManager & mgr)

Constructor.

Parameters
mgrReference to the menu manager

Creates a new menu associated with the specified menu manager. The menu starts with no elements and is inactive (not displayed).

◆ ~DtMenu()

virtual makVre::DtMenu::~DtMenu ( )
virtual

Virtual destructor.

Ensures proper cleanup of all menu resources and derived menu classes.

Member Function Documentation

◆ name()

virtual const std::string & makVre::DtMenu::name ( )
virtual

Gets the menu's identifier name.

Returns
Reference to the menu's name string

Returns the user-supplied name of the menu. This name is used to identify and look up the menu in the menu manager registry.

Referenced by findElement(), removeElement(), selectElement(), setName(), and setParent().

◆ setName()

virtual void makVre::DtMenu::setName ( const std::string & name)
virtual

Sets the menu's identifier name.

Parameters
nameThe name to assign to this menu

Sets the user-supplied name of the menu. This name is used to identify and look up the menu in the menu manager registry.

References name().

◆ setPosition()

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

Sets the position of the menu.

Parameters
xHorizontal position in pixels from the left edge
yVertical position in pixels from the top edge

Sets the position of the menu on the screen in pixel coordinates. The position represents the top-left corner of the menu.

References x(), and y().

◆ x()

virtual float makVre::DtMenu::x ( ) const
inlinevirtual

Gets the menu's horizontal position.

Returns
Horizontal position in pixels

Returns the current horizontal position of the menu.

References myX.

Referenced by setPosition(), and setSize().

◆ y()

virtual float makVre::DtMenu::y ( ) const
inlinevirtual

Gets the menu's vertical position.

Returns
Vertical position in pixels

Returns the current vertical position of the menu.

References myY.

Referenced by setPosition(), and setSize().

◆ setSize()

virtual void makVre::DtMenu::setSize ( float x,
float y )
virtual

Sets the size of the menu.

Parameters
xWidth in pixels
yHeight in pixels

Sets the size of the menu in pixel dimensions.

References x(), and y().

◆ width()

virtual float makVre::DtMenu::width ( ) const
inlinevirtual

Gets the menu's width.

Returns
Width in pixels

Returns the current width of the menu.

References myWidth.

◆ height()

virtual float makVre::DtMenu::height ( ) const
inlinevirtual

Gets the menu's height.

Returns
Height in pixels

Returns the current height of the menu.

References myHeight.

◆ setActive()

virtual void makVre::DtMenu::setActive ( bool active,
bool saveSelection = false,
bool closeOnElementSelected = false )
virtual

Sets the active state of the menu.

Parameters
activeTrue to activate (show) the menu, false to deactivate (hide)
saveSelectionIf true, preserve selection from last time the menu was open
closeOnElementSelectedIf true, close menu when an element is selected

Controls whether the menu is visible and interactive. When activated, the menu will either restore its previous selection (if saveSelection is true) or select the first valid element. If closeOnElementSelected is true, the menu will automatically close after an element is selected or if there are no valid selections available.

Reimplemented in makVre::DtActionInputMenu.

◆ isActive()

virtual bool makVre::DtMenu::isActive ( ) const
virtual

Checks if the menu is currently active.

Returns
True if the menu is active (visible), false otherwise

Determines whether the menu is currently visible and interactive.

◆ isEmpty()

virtual bool makVre::DtMenu::isEmpty ( ) const
virtual

Checks if the menu has any elements.

Returns
True if the menu has no elements, false if it has at least one

Determines whether the menu contains any elements.

◆ tick()

virtual void makVre::DtMenu::tick ( double dt)
virtual

Updates the menu's state and visuals.

Parameters
dtTime elapsed since the last update in seconds

Called once per frame to update the menu's state and refresh its visual representation. This handles animation, scrolling, and display updates.

◆ activateInputLogic()

virtual void makVre::DtMenu::activateInputLogic ( )
virtual

Initializes the input handling logic for the menu.

Sets up the input logic system for this menu, mapping input events (keyboard, mouse, controller buttons, etc.) to menu action handlers. This establishes all the input handlers needed for navigating and interacting with the menu, such as selection, scrolling, and item activation.

This is automatically called when the menu becomes active.

Reimplemented in makVre::DtActionInputMenu.

◆ deactivateInputLogic()

virtual void makVre::DtMenu::deactivateInputLogic ( )
virtual

Shuts down the input handling logic for the menu.

Deactivates the input logic system for this menu, removing all input handlers and cleaning up resources. This prevents the menu from responding to input events when it's no longer active.

This is automatically called when the menu becomes inactive.

◆ title()

virtual const std::string & makVre::DtMenu::title ( ) const
inlinevirtual

Gets the menu title text.

Returns
Reference to the title string

Returns the title text displayed at the top of the menu.

References myTitleString.

Referenced by setTitle().

◆ setTitle()

virtual void makVre::DtMenu::setTitle ( const std::string & title)
virtual

Sets the menu title text.

Parameters
titleThe title text to display

Sets the title text to be displayed at the top of the menu. This is typically shown in a header area above the menu elements.

References title().

◆ titleAttribute()

virtual const std::string & makVre::DtMenu::titleAttribute ( ) const
inlinevirtual

Gets the menu title text.

Returns
Reference to the title string

Returns the title text displayed at the top of the menu.

References myTitleAttribute.

Referenced by setTitleAttribute().

◆ setTitleAttribute()

void makVre::DtMenu::setTitleAttribute ( const std::string & titleAttribute)

Sets the menu title text.

Parameters
titleThe title text to display

Sets the title text to be displayed at the top of the menu. This is typically shown in a header area above the menu elements.

Sets the attribute path used for the menu title

Parameters
titleAttributeThe attribute path to use for dynamically updating the menu title

References titleAttribute().

◆ setShowTitle()

virtual void makVre::DtMenu::setShowTitle ( bool show)
virtual

Sets whether to show the menu title.

Parameters
showTrue to show the title, false to hide it

Controls the visibility of the menu title. When enabled, the title is displayed at the top of the menu. When disabled, no title is shown.

◆ addElement()

virtual void makVre::DtMenu::addElement ( DtMenuElement * element)
virtual

Adds an element to the menu.

Parameters
elementPointer to the menu element to add

Adds the specified element to this menu. If there is no currently selected element, the new element will become the selected element if it is enabled. The menu takes ownership of the element and will delete it when the menu is destroyed or when the element is removed.

◆ removeElement() [1/2]

virtual DtMenuElement * makVre::DtMenu::removeElement ( DtMenuElement * element)
virtual

Removes an element from the menu by pointer.

Parameters
elementPointer to the element to remove
Returns
Pointer to the removed element, or NULL if not found

Removes the specified element from the menu. If the removed element was the currently selected element, the selection will be updated to the nearest valid element. The caller becomes responsible for deleting the returned element to avoid memory leaks.

◆ removeElement() [2/2]

virtual DtMenuElement * makVre::DtMenu::removeElement ( const std::string & name)
virtual

Removes an element from the menu by name.

Parameters
nameName of the element to remove
Returns
Pointer to the removed element, or NULL if not found

Removes the element with the specified name from the menu. If the removed element was the currently selected element, the selection will be updated to the nearest valid element. The caller becomes responsible for deleting the returned element to avoid memory leaks.

References name().

◆ findElement()

virtual DtMenuElement * makVre::DtMenu::findElement ( const std::string & name)
virtual

Finds a menu element by name.

Parameters
nameName of the element to find
Returns
Pointer to the found element, or NULL if not found

Searches for and returns the menu element with the specified name. Returns NULL if no element with that name exists in the menu.

References name().

◆ elements()

virtual std::vector< DtMenuElement * > makVre::DtMenu::elements ( )
virtual

Gets all elements in the menu.

Returns
Vector of pointers to all menu elements

Returns a vector containing pointers to all elements in the menu. The elements remain owned by the menu; the caller should not delete them.

◆ selectElement() [1/2]

virtual bool makVre::DtMenu::selectElement ( int index)
virtual

Selects a menu element by index.

Parameters
indexZero-based index of the element to select
Returns
True if selection was changed to a valid element, false otherwise

Attempts to select the element at the specified index. If the requested element is not enabled or does not exist, it will try to select the next enabled element. Returns true if the selection successfully changed to a valid element, false if the selection remained unchanged or no valid selection was possible.

◆ selectElementByOnScreenIndex()

virtual void makVre::DtMenu::selectElementByOnScreenIndex ( int index)
virtual

Selects a menu element by its on-screen index.

Parameters
indexOn-screen index of the element to select (as displayed to the user)

Selects the element with the specified on-screen index. On-screen indices are only assigned to visible and enabled elements, and are used for keyboard shortcuts (e.g., pressing 1-9 to select menu items 1-9).

◆ selectElement() [2/2]

virtual bool makVre::DtMenu::selectElement ( const std::string & name)
virtual

Selects a menu element by name.

Parameters
nameName of the element to select
Returns
True if the element was found and selected, false otherwise

Attempts to select the element with the specified name. Returns true if the element was found and successfully selected, false if the element was not found or could not be selected (e.g., because it is disabled).

References name().

◆ selectNext()

virtual void makVre::DtMenu::selectNext ( float val = 1)
virtual

Selects the next enabled element in the menu.

Parameters
valInput value (typically 1.0 for full activation)

Moves the selection to the next enabled element in the menu. If already at the last element, the selection will not change. The val parameter supports analog inputs (like joysticks) that may not be fully activated.

◆ selectPrevious()

virtual void makVre::DtMenu::selectPrevious ( float val = 1)
virtual

Selects the previous enabled element in the menu.

Parameters
valInput value (typically 1.0 for full activation)

Moves the selection to the previous enabled element in the menu. If already at the first element, the selection will not change. The val parameter supports analog inputs (like joysticks) that may not be fully activated.

◆ selectedElement()

virtual DtMenuElement * makVre::DtMenu::selectedElement ( )
virtual

Gets the currently selected menu element.

Returns
Pointer to the selected element, or nullptr if no element is selected

Returns a pointer to the currently selected menu element. Returns nullptr if no element is currently selected, which can happen if the menu is empty or if no elements are enabled.

◆ selectedElementIndex()

virtual int makVre::DtMenu::selectedElementIndex ( ) const
inlinevirtual

Gets the index of the currently selected element.

Returns
Index of the selected element, or -1 if no element is selected

Returns the index of the currently selected menu element in the list of enabled elements. Returns -1 if no element is currently selected, which can happen if the menu is empty or if no elements are enabled.

References mySelectedItem.

◆ clearSelected()

virtual void makVre::DtMenu::clearSelected ( )
virtual

Clears the current selection.

Removes the current element selection, leaving no element selected. This is useful when you want to reset the menu state or when no element should be highlighted.

◆ scrollToItem() [1/2]

virtual bool makVre::DtMenu::scrollToItem ( int index)
inlinevirtual

Scrolls the menu to show a specific item.

Parameters
indexIndex of the item to scroll to
Returns
True if successful, false otherwise

Adjusts the menu scroll position to ensure the element at the specified index is visible. This automatically updates the menu visuals. Returns true if the scroll was successful, false otherwise.

References scrollToItem().

Referenced by scrollToItem().

◆ scrollDown()

virtual void makVre::DtMenu::scrollDown ( )
virtual

Scrolls the menu down one item.

Scrolls the menu down by one item, showing the next set of elements if the menu contains more elements than can be displayed at once.

◆ scrollUp()

virtual void makVre::DtMenu::scrollUp ( )
virtual

Scrolls the menu up one item.

Scrolls the menu up by one item, showing the previous set of elements if the menu has been scrolled down.

◆ scroll()

virtual void makVre::DtMenu::scroll ( float val)
virtual

Scrolls the menu by a variable amount.

Parameters
valAmount to scroll, positive for down, negative for up

Scrolls the menu by the specified amount. Positive values scroll down, negative values scroll up. The val parameter supports analog inputs (like joysticks) for variable-speed scrolling.

◆ pageUp()

virtual void makVre::DtMenu::pageUp ( float val = 1)
virtual

Scrolls the menu up by a page.

Parameters
valInput value (typically 1.0 for full page)

Scrolls the menu up by one page (the number of visible elements). The val parameter supports analog inputs for partial page scrolling.

◆ pageDown()

virtual void makVre::DtMenu::pageDown ( float val = 1)
virtual

Scrolls the menu down by a page.

Parameters
valInput value (typically 1.0 for full page)

Scrolls the menu down by one page (the number of visible elements). The val parameter supports analog inputs for partial page scrolling.

◆ updateElements()

virtual void makVre::DtMenu::updateElements ( )
virtual

Updates the enabled element list.

Refreshes the internal list of enabled elements based on the current state of all menu elements. This rebuilds the myEnabledItems list, recalculating which elements are visible and enabled based on their display conditions. Called automatically when menu state changes affect element visibility.

◆ updateVisuals()

virtual void makVre::DtMenu::updateVisuals ( )
virtual

Updates the visual representation of the menu.

Refreshes the visual display of the menu based on the current state. This updates element positions, scrolling state, and visual properties. Called automatically when the menu's state changes in a way that affects its visual appearance.

◆ addElementGenerator()

virtual void makVre::DtMenu::addElementGenerator ( DtMenuAttributeObserver * generator)
virtual

Adds a dynamic element generator to the menu.

Parameters
generatorPointer to the attribute observer that generates elements

Sets an attribute observer that will dynamically generate menu elements based on attribute values. This allows menus to automatically update their contents when attributes change. The menu takes ownership of the generator and will delete it when the menu is destroyed.

◆ setParent()

virtual void makVre::DtMenu::setParent ( const std::string & name)
virtual

Sets the parent menu by name.

Parameters
nameName of the parent menu

Establishes a parent-child relationship between menus. When this menu is closed, the parent menu will be reopened if it exists. This creates a hierarchical menu structure for navigation.

References name().

◆ setInheritParentPosition()

virtual void makVre::DtMenu::setInheritParentPosition ( bool set)
virtual

Sets whether to inherit position from parent menu.

Parameters
setTrue to inherit parent position, false to use own position

When set to true, this menu will adopt the same position as its parent menu. This is useful for submenus that should appear in the same location as their parent menu for visual continuity.

◆ setInheritParentSize()

virtual void makVre::DtMenu::setInheritParentSize ( bool set)
virtual

Sets whether to inherit size from parent menu.

Parameters
setTrue to inherit parent size, false to use own size

When set to true, this menu will adopt the same size as its parent menu. This is useful for submenus that should maintain the same dimensions as their parent menu for visual consistency.

◆ parent()

virtual const std::string & makVre::DtMenu::parent ( ) const
virtual

Gets the name of the parent menu.

Returns
Reference to the parent menu name string

Returns the name of this menu's parent menu. Returns an empty string if this menu has no parent.

◆ closeMenu()

virtual void makVre::DtMenu::closeMenu ( float val = 1)
virtual

Closes the menu.

Parameters
valInput value (typically 1.0 for full activation)

Closes this menu, deactivating it and hiding it from view. If the menu has a parent, the parent menu will be activated. The val parameter supports analog inputs for partial activation.

◆ select()

virtual void makVre::DtMenu::select ( float val = 1)
virtual

Selects the currently highlighted menu element.

Parameters
valInput value (typically 1.0 for full activation)

Executes the action associated with the currently selected menu element. For action elements, this will trigger the action. For menu elements, this will open the submenu. The val parameter supports analog inputs for partial activation.

Reimplemented in makVre::DtActionInputMenu.

◆ selectItem()

virtual void makVre::DtMenu::selectItem ( float val,
unsigned int num )
virtual

Selects a menu item by number with analog input support.

Parameters
valInput value (typically 1.0 for full activation)
numIndex of the item to select (1-based)

General handler for numerical item selection. This allows selecting a menu item by its displayed number. The val parameter supports analog inputs for partial activation.

◆ select1()

virtual void makVre::DtMenu::select1 ( float val)
virtual

Selects the first menu item.

Parameters
valInput value (typically 1.0 for full activation)

Selects the first visible menu item. The val parameter supports analog inputs for partial activation.

◆ select2()

virtual void makVre::DtMenu::select2 ( float val)
virtual

Selects the second menu item.

Parameters
valInput value (typically 1.0 for full activation)

◆ select3()

virtual void makVre::DtMenu::select3 ( float val)
virtual

Selects the third menu item.

Parameters
valInput value (typically 1.0 for full activation)

◆ select4()

virtual void makVre::DtMenu::select4 ( float val)
virtual

Selects the fourth menu item.

Parameters
valInput value (typically 1.0 for full activation)

◆ select5()

virtual void makVre::DtMenu::select5 ( float val)
virtual

Selects the fifth menu item.

Parameters
valInput value (typically 1.0 for full activation)

◆ select6()

virtual void makVre::DtMenu::select6 ( float val)
virtual

Selects the sixth menu item.

Parameters
valInput value (typically 1.0 for full activation)

◆ select7()

virtual void makVre::DtMenu::select7 ( float val)
virtual

Selects the seventh menu item.

Parameters
valInput value (typically 1.0 for full activation)

◆ select8()

virtual void makVre::DtMenu::select8 ( float val)
virtual

Selects the eighth menu item.

Parameters
valInput value (typically 1.0 for full activation)

◆ select9()

virtual void makVre::DtMenu::select9 ( float val)
virtual

Selects the ninth menu item.

Parameters
valInput value (typically 1.0 for full activation)

◆ select10()

virtual void makVre::DtMenu::select10 ( float val)
virtual

Selects the tenth menu item.

Parameters
valInput value (typically 1.0 for full activation)

◆ back()

virtual void makVre::DtMenu::back ( float val = 1)
virtual

Navigates back to the parent menu.

Parameters
valInput value (typically 1.0 for full activation)

Closes this menu and returns to the parent menu if one exists. Equivalent to pressing the Back button or Escape key. The val parameter supports analog inputs for partial activation.

◆ displayConditions() [1/2]

virtual const DtMenuDisplayConditions & makVre::DtMenu::displayConditions ( ) const
virtual

Gets the display conditions for this menu (const version)

Returns
Constant reference to the menu's display conditions

Returns a constant reference to the conditions that determine when this menu should be displayed. These include context-sensitive conditions like player posture.

◆ displayConditions() [2/2]

virtual DtMenuDisplayConditions & makVre::DtMenu::displayConditions ( )
virtual

Gets the display conditions for this menu (mutable version)

Returns
Mutable reference to the menu's display conditions

Returns a mutable reference to the conditions that determine when this menu should be displayed. These can be modified to change when the menu is available to the player.

◆ containsEnabledDuplicate()

virtual bool makVre::DtMenu::containsEnabledDuplicate ( DtMenuElement * element)
virtual

Checks if a duplicate element exists in the enabled list.

Parameters
elementPointer to the element to check for duplicates
Returns
True if a duplicate exists, false otherwise

Determines whether another enabled element with the same label as the specified element already exists in the menu. This is used to prevent duplicate entries in dynamically generated menus.

◆ manager()

virtual DtMenuManager & makVre::DtMenu::manager ( )
inlinevirtual

Gets the menu manager for this menu.

Returns
Reference to the menu manager

Returns a reference to the menu manager that controls this menu. The menu manager handles menu registration, parent-child relationships, and other menu system functionality.

References myManager.

◆ setType()

void makVre::DtMenu::setType ( Type type)
inline

Sets the menu type.

Parameters
typeType of menu to set

Sets the type of this menu, which affects its behavior and appearance.

References myType, and type().

◆ type()

Type makVre::DtMenu::type ( )
inline

Gets the menu type.

Returns
Current menu type

Returns the current type of this menu.

References myType.

Referenced by setType().

◆ clearElements()

virtual void makVre::DtMenu::clearElements ( )
virtual

Removes all elements from the menu.

Clears the menu by removing and deleting all its elements. This resets the menu to an empty state, removing all options.

◆ triggerActionFromQML()

void makVre::DtMenu::triggerActionFromQML ( int index)

Triggers an action from QML interface.

Parameters
indexIndex of the element to trigger

Executes the action associated with the element at the specified index. This is used for integration with QML-based user interfaces, allowing QML components to trigger menu actions.

◆ handlePlayerControlsState()

virtual DtVreMessageResult makVre::DtMenu::handlePlayerControlsState ( DtVreMessage * msg)
protectedvirtual

Handles player controls state change messages.

Parameters
msgPointer to the message to handle
Returns
Message handling result

Processes messages about changes in player controls state. When controls are disabled, this automatically closes the menu to prevent interaction when the player cannot control the menu.

◆ handleMenuInputMessage()

virtual DtVreMessageResult makVre::DtMenu::handleMenuInputMessage ( DtVreMessage * msg)
protectedvirtual

Handles menu input messages from VR controllers.

Parameters
msgPointer to the message to handle
Returns
Message handling result

Processes input messages specifically designed for VR control of menus. This provides a bridge for VR controller input to interact with menus until a more integrated VR input system is implemented.

◆ scrollToItem() [2/2]

virtual bool makVre::DtMenu::scrollToItem ( int index,
bool doUpdate )
protectedvirtual

Internal implementation of scrollToItem.

Parameters
indexIndex of the item to scroll to
doUpdateWhether to update the visual display after scrolling
Returns
True if scroll was successful, false otherwise

Adjusts the scroll position to ensure the element at the specified index is visible. The doUpdate parameter controls whether the menu visuals are immediately updated after scrolling, which is useful for batch operations where multiple scrolls might occur before the final update.

◆ updateImguiUI()

virtual void makVre::DtMenu::updateImguiUI ( )
protectedvirtual

Updates the ImGui-based user interface.

Refreshes the menu's user interface components using the ImGui framework. This handles the rendering of the menu background, elements, scrollbars, and other visual components. Called internally by the tick method when the menu needs to be visually updated.

Member Data Documentation

◆ myManager

DtMenuManager& makVre::DtMenu::myManager
protected

Reference to the menu manager.

Reference to the menu manager that controls this menu. The menu manager handles menu registration, parent-child relationships, and other menu system functionality.

Referenced by manager().

◆ myName

std::string makVre::DtMenu::myName
protected

Name identifier for this menu.

Unique name that identifies this menu in the menu system. Used for menu lookup and parent-child relationships.

◆ myTitleString

std::string makVre::DtMenu::myTitleString
protected

Title text displayed at the top of the menu.

Text shown in the menu's title bar, describing the menu's purpose.

Referenced by title().

◆ myTitleAttribute

std::string makVre::DtMenu::myTitleAttribute
protected

Title attribute for the menu.

The attribute name to get the title's text from.

Referenced by titleAttribute().

◆ myParent

std::string makVre::DtMenu::myParent
protected

Name of the parent menu.

Name of this menu's parent menu. When this menu is closed, the parent menu will be activated if it exists. Empty string indicates no parent.

◆ myDisplayConditions

DtMenuDisplayConditions makVre::DtMenu::myDisplayConditions
protected

Display conditions for this menu.

Conditions that determine when this menu should be displayed, such as player posture requirements.

◆ myType

Type makVre::DtMenu::myType
protected

Type of this menu (STATIC or QUICK)

Determines the menu's behavior and appearance. STATIC menus persist until explicitly closed, while QUICK menus are context-sensitive and temporary.

Referenced by setType(), and type().

◆ myX

float makVre::DtMenu::myX
protected

Position and size of the menu in pixels.

Coordinates and dimensions that define the menu's location and size on the screen. The position (myX, myY) represents the top-left corner of the menu rectangle.

Referenced by x().

◆ myY

float makVre::DtMenu::myY
protected

Referenced by y().

◆ myWidth

float makVre::DtMenu::myWidth
protected

Referenced by width().

◆ myHeight

float makVre::DtMenu::myHeight
protected

Referenced by height().

◆ myIsActive

bool makVre::DtMenu::myIsActive
protected

Active state of the menu.

Indicates whether the menu is currently active (visible and interactive).

◆ myShowTitle

bool makVre::DtMenu::myShowTitle
protected

Whether to show the menu title.

Controls visibility of the title bar at the top of the menu.

◆ myNeedParentSize

bool makVre::DtMenu::myNeedParentSize
protected

Whether to inherit size from parent menu.

When true, this menu adopts the same size as its parent menu.

◆ myNeedParentPosition

bool makVre::DtMenu::myNeedParentPosition
protected

Whether to inherit position from parent menu.

When true, this menu appears at the same position as its parent menu.

◆ myShouldShowNumbers

bool makVre::DtMenu::myShouldShowNumbers
protected

Whether to show numerical indices for menu items.

When true, menu elements are displayed with numerical indices (1, 2, 3...) that can be used for keyboard shortcuts. Input menus typically disable this.

◆ myItems

std::vector<Item*> makVre::DtMenu::myItems
protected

List of all menu items, owned by this menu.

Vector of all menu items, including both enabled and disabled ones. The menu owns these items and is responsible for deleting them.

◆ myEnabledItems

std::vector<Item*> makVre::DtMenu::myEnabledItems
protected

List of currently enabled menu items.

Vector of pointers to enabled menu items only. These are not owned by this vector, but are references to items in myItems. This list is rebuilt whenever element states change, and is used for display and selection.

◆ mySelectedItem

Item* makVre::DtMenu::mySelectedItem
protected

Pointer to the currently selected item.

Points to the item that is currently selected in the menu. This is a reference to an item in myEnabledItems. Null if no item is selected.

Referenced by selectedElementIndex().

◆ mySavedSelection

Item* makVre::DtMenu::mySavedSelection
protected

Pointer to the saved selection for menu reopening.

When a menu is closed with saveSelection=true, this stores the last selected item so it can be restored when the menu is reopened.

◆ myScrollUp

Item makVre::DtMenu::myScrollUp
protected

Special items for scroll indicators.

Items representing the scroll up and scroll down indicators that appear at the top and bottom of the menu when not all items can be displayed at once.

◆ myScrollDown

Item makVre::DtMenu::myScrollDown
protected

◆ myCanScrollUp

bool makVre::DtMenu::myCanScrollUp
protected

Whether the menu can scroll upward.

Indicates if there are additional items above the currently visible ones.

◆ myCanScrollDown

bool makVre::DtMenu::myCanScrollDown
protected

Whether the menu can scroll downward.

Indicates if there are additional items below the currently visible ones.

◆ myScrollOffset

int makVre::DtMenu::myScrollOffset
protected

Current scroll position in the menu.

Index of the first visible item in the list of enabled items.

◆ myVisibleScrollItems

int makVre::DtMenu::myVisibleScrollItems
protected

Number of items that can be displayed at once.

Maximum number of menu elements that can be displayed simultaneously based on menu height and element height.

◆ myActionFlash

double makVre::DtMenu::myActionFlash
protected

Timer for action selection flash effect.

Used to create a visual flash effect when an action is selected. Counts down from a positive value to zero.

◆ myCloseOnSelection

bool makVre::DtMenu::myCloseOnSelection
protected

Whether to close the menu after an element is selected.

When true, the menu automatically closes after an element is selected. This is commonly used for context menus and quick menus.

◆ myLineHeight

int makVre::DtMenu::myLineHeight
protected

Height of each menu element line in pixels.

Used for layout calculations and determining how many elements can be displayed at once.

◆ myElementGenerator

DtMenuAttributeObserver* makVre::DtMenu::myElementGenerator
protected

Element generator for dynamic menu content.

Observer that dynamically generates menu elements based on attribute values. This allows the menu to update its content automatically when relevant attributes change.

◆ myInputLogic

DtInputLogic makVre::DtMenu::myInputLogic
protected

Input logic for menu interaction.

Handles input event processing for menu navigation and selection. Maps input events to menu actions like selection, scrolling, and activation.


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