|
VR-Engage
2.2
|
DtChooseRoleState represents the application state where users can select existing entities to control or create new entities. It manages the UI interactions, entity creation, and transitions to the engaged state.
#include <chooseRoleState.h>
Classes | |
| struct | AttachToEntity |
| struct | EntityDefinition |
| struct | StationDefinition |
Public Member Functions | |
| DtChooseRoleState (DtPlayerStationApp &app) | |
| virtual | ~DtChooseRoleState () override |
| virtual void | onEnter (const DtPlayerStationStateArgs *args) override |
| virtual void | onExit () override |
| virtual void | tick (double dt) override |
| virtual void | onExposed () override |
| virtual void | onStacked () override |
| virtual const DtEntityType & | getNewEntityType () |
| virtual const DtEntityIdentifier & | getCreatedOwnshipEntity () const |
| virtual makVrv::DtElementID | getCreatedOwnshipElement () const |
| virtual void | playStation (const std::string &role, const DtEntityIdentifier &entityId=DtEntityIdentifier::nullId(), const std::string &displayLayout="") |
| virtual void | play (bool asSpectator=false) |
| virtual DtVreMessageResult | handleAssignRolePlayer (DtVreMessage *message) |
| virtual void | setObserverViewsPanelVisible (bool visible) |
| virtual void | setCreatingOwnship (bool newNotExisting) |
| virtual void | setNewEntityName (const std::string &name) |
| virtual void | setNewEntityType (const DtEntityType &type) |
| virtual void | setNewEntityForce (const DtForceType &force) |
| virtual void | setNewEntityLocation (const DtVector &location) |
| virtual void | setNewEntityLocationAtAltitude (const DtVector &location, double altitude) |
| virtual void | setNewEntityClamp (bool clamp) |
| virtual void | setNewEntityHeading (const double headingInDegrees) |
| virtual void | setNewEntityPitch (const double pitch) |
| virtual void | setNewEntityEmbarkedOn (const DtEntityIdentifier &host, const DtVector &offset) |
Public Member Functions inherited from makVre::DtPlayerStationState | |
| DtPlayerStationState (DtPlayerStationApp &app, std::string stateType) | |
| virtual | ~DtPlayerStationState () |
| DtPlayerStationState (const DtPlayerStationState &)=delete | |
| DtPlayerStationState & | operator= (const DtPlayerStationState &)=delete |
| virtual void | onEnter () |
| virtual void | onExposed (const DtPlayerStationStateArgs *args) |
| bool | active () const |
| bool | exposed () const |
| bool | exiting () const |
| bool | stacking () const |
| const std::string & | stateType () const |
| DtPlayerStationApp & | app () const |
Protected Types | |
| enum | DirtyBits { DirtyName = 1 << 0 , DirtyType = 1 << 1 , DirtyForce = 1 << 2 , DirtyPosition = 1 << 3 , DirtyHeading = 1 << 4 , DirtyPitch = 1 << 5 , DirtyRoll = 1 << 6 } |
Protected Attributes | |
| bool | myWantNewEntity |
| bool | myAwaitingNewRealizedEntity |
| bool | myHaveNewEntity |
| EntityDefinition | myNewEntityDef |
| StationDefinition | myStationDef |
| DtEntityIdentifier | myHostId |
| DtVector | myHostOffset |
| int | myDirtyBits |
| DtChooseRolePanel * | myEntityPanel |
| std::shared_ptr< DtVreChooseRolePage > | myChooseRolePage |
| std::shared_ptr< AttachToEntity > | myAttachToEntity |
Protected Attributes inherited from makVre::DtPlayerStationState | |
| DtPlayerStationApp & | myApp |
|
protected |
Flags indicating which entity properties have changed.
Used to track which properties of the entity definition have been modified and need to be updated in the simulation.
| makVre::DtChooseRoleState::DtChooseRoleState | ( | DtPlayerStationApp & | app | ) |
Constructor.
| app | Reference to the player station application |
Creates a new role selection state associated with the given application.
References makVre::DtPlayerStationState::app().
|
overridevirtual |
Virtual destructor.
Ensures proper cleanup of the role selection state resources.
|
overridevirtual |
Called when the state is entered.
| args | Pointer to arguments from the previous state |
Sets up the role selection UI and observer views, registers message handlers, and initializes the state's data structures. This is called when the player first enters the role selection state.
Reimplemented from makVre::DtPlayerStationState.
|
overridevirtual |
Called when the state is exited.
Cleans up resources, hides UI elements, and unregisters message handlers. This is called when the player leaves the role selection state.
Reimplemented from makVre::DtPlayerStationState.
|
overridevirtual |
Updates the state each frame.
| dt | Time in seconds since the last update |
Handles per-frame processing, such as updating entity status, managing user interactions, and handling deferred operations.
Reimplemented from makVre::DtPlayerStationState.
|
overridevirtual |
Called when the state becomes the topmost state again.
Restores UI visibility and updates the panel when this state is exposed after another state has been popped from the stack.
Reimplemented from makVre::DtPlayerStationState.
|
overridevirtual |
Called when another state is pushed on top of this one.
Hides UI elements and pauses processing while this state is covered by another state on the stack.
Reimplemented from makVre::DtPlayerStationState.
|
virtual |
Entity creation methods.
Sets whether a new entity should be created
| newNotExisting | True to create a new entity, false to use an existing one |
Determines whether the player will create a new entity or control an existing one.
|
virtual |
Sets the name for a new entity.
| name | Name to assign to the new entity |
Sets the display name for the entity being created.
|
virtual |
Sets the type for a new entity.
| type | Type identifier for the new entity |
Sets the type of entity to create (e.g., aircraft, vehicle, infantry).
|
virtual |
Sets the force type for a new entity.
| force | Force type for the new entity (friendly, hostile, etc.) |
Sets the force affiliation for the entity being created.
|
virtual |
Sets the location for a new entity.
| location | 3D position for the new entity (at ground level) |
Sets the ground location where the entity will be created.
|
virtual |
Sets the location and altitude for a new entity.
| location | 3D position for the new entity (ground reference) |
| altitude | Height above ground in meters |
Sets both the ground position and altitude for the entity being created.
|
virtual |
Sets whether the entity should be clamped to terrain.
| clamp | True to clamp to terrain, false otherwise |
Determines whether the entity should be constrained to follow terrain contours.
|
virtual |
Sets the heading for a new entity.
| headingInDegrees | Heading in degrees (0-360, clockwise from north) |
Sets the initial heading for the entity being created. This assumes the location has already been set.
|
virtual |
Sets the pitch for a new entity.
| pitch | Pitch angle in degrees |
Sets the initial pitch angle for the entity being created.
|
virtual |
Sets a parent entity for embarking.
| host | Entity identifier of the host/parent entity |
| offset | Relative offset from the host entity's position |
Specifies that the new entity should be created as embarked on another entity.
|
inlinevirtual |
Gets the type of the entity being created.
Retrieves the entity type that has been set for creation.
References myNewEntityDef.
|
virtual |
Gets the identifier of the created entity.
Retrieves the unique identifier of the entity that was created. Only valid after entity creation is complete.
|
virtual |
Gets the element ID of the created entity.
Retrieves the display engine element ID for the created entity. Only valid after entity creation is complete.
|
virtual |
Updates the player station with role information.
| role | Name of the role to play |
| entityId | Identifier of the entity to control (null for new entities) |
| displayLayout | Name of the display layout to use |
Sets up the player station with the selected role, entity, and display layout in preparation for transitioning to the engaged state.
|
virtual |
Initiates engagement with the selected entity.
| asSpectator | True to engage as a spectator, false as a controller |
Transitions from the role selection state to the engaged state, starting gameplay with the selected entity and role.
|
virtual |
Handles role assignment messages.
| message | Pointer to the role assignment message |
Processes messages related to assigning roles to players, which may come from network or local sources.
|
virtual |
Controls visibility of the observer views panel.
| visible | True to show the panel, false to hide it |
Shows or hides the observer views panel that provides alternative viewpoints of the simulated environment.
|
protectedvirtual |
Controls visibility of the UI components.
| visible | True to show UI elements, false to hide them |
Manages the visibility of the choose role page and entity panel components. Used when entering/exiting the state or when stacked/exposed.
|
protectedvirtual |
Resets the entity panel to its default state.
Clears all selections and inputs in the entity panel, preparing it for a fresh interaction.
|
protectedvirtual |
Message handlers.
Handles messages about newly created ownship entities
| message | Pointer to the message about the new entity |
|
protectedvirtual |
Handles messages about entities being realized in the simulation.
| message | Pointer to the entity realization message |
|
protectedvirtual |
Handles messages about application mode changes.
| message | Pointer to the application mode message |
|
protectedvirtual |
Handles escape key press messages.
| msg | Pointer to the key press message |
|
protectedvirtual |
Handles back button click messages.
| msg | Pointer to the button click message |
|
protectedvirtual |
Handles choose role button click messages.
| msg | Pointer to the button click message |
|
protectedvirtual |
Handles VRF rewind messages.
| msg | Pointer to the rewind message |
|
protectedvirtual |
Entity management methods.
Creates a new entity in the simulation
Uses the information in myNewEntityDef to create a new entity in the simulation and start tracking its realization.
|
protectedvirtual |
Updates an existing new entity.
Applies changes from myNewEntityDef to the entity that is currently being created or modified.
|
protectedvirtual |
Destroys a new entity that was being created.
Removes the entity that was being created from the simulation. Typically called when canceling entity creation or during cleanup.
|
protectedvirtual |
Checks if a new ownship entity has been realized.
Determines whether a newly created entity has been fully realized in the simulation and is ready for interaction.
|
protectedvirtual |
Called when a new ownship entity is realized.
Handles the completion of entity creation, transitioning to the next step in the engagement process.
|
protectedvirtual |
Gets the display layout for a station.
| station | Station definition to get layout for |
Determines the appropriate display layout for the given station, using defaults if necessary.
|
protectedvirtual |
Validates an entity definition.
| def | Entity definition to validate |
| error | Optional pointer to receive error message |
Checks whether an entity definition contains all the required information to create a valid entity.
|
protectedvirtual |
Validates a station definition.
| def | Station definition to validate |
| error | Optional pointer to receive error message |
Checks whether a station definition contains all the required information to set up a player station.
|
protected |
Flag indicating whether to create a new entity.
|
protected |
Flag indicating that entity creation is in progress.
|
protected |
Flag indicating that a new entity has been created.
|
protected |
Definition of the entity to create.
Referenced by getNewEntityType().
|
protected |
Definition of the station to set up.
|
protected |
Identifier of the host entity for embarking.
|
protected |
Offset from the host entity for embarking.
|
protected |
Bitmap of dirty flags for the entity definition.
|
protected |
Pointer to the entity selection panel UI.
|
protected |
Shared pointer to the role selection page.
|
protected |
Shared pointer to the entity attachment configuration.