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

Detailed Description

DtVreJoystickController enables joystick control for entities by creating and managing the appropriate output ports for joystick inputs. It serves as a bridge between physical joystick inputs and the simulation, translating joystick actions into appropriate entity control commands. The controller handles connect and disconnect events, commander override states, and port value updates.

Uses Descriptor Type: DtVreJoystickControllerDescriptor

#include <vreJoystickController.h>

Inheritance diagram for makVre::DtVreJoystickController:
[legend]

Public Member Functions

 DtVreJoystickController (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtVreJoystickController () override
 
virtual const char * type () const override
 
virtual bool init () override
 
virtual bool createPortGroups () override
 
virtual bool createPorts () override
 
- Public Member Functions inherited from makVre::DtVreSimComponent< DtControllerComponent >
 DtVreSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtVreSimComponent ()
 
bool isPlayerControlled (const std::string &role="") const
 
DtString entitySystemName () const
 

Static Public Member Functions

static DtSimComponent * creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 

Protected Types

using OutputPortMap = std::map<std::string, DtOutputPort*>
 

Protected Member Functions

virtual DtVreMessageResult handleCommanderOverride (DtVreMessage *msg)
 
virtual void calcAndSetPortValues (const DtString &functionGroup, const DtString &function, double value, bool repeat) override
 
virtual void joystickConnected () override
 
virtual void joystickDisconnected () override
 
virtual void tick () override
 

Protected Attributes

std::string myOutputPortGroupName
 
DtOutputPortGroup * myOutputGroup
 
OutputPortMap myOutputPorts
 
bool myCommanderOverrideActive
 

Private Member Functions

 DtVreJoystickController ()
 
 DtVreJoystickController (const DtVreJoystickController &orig)
 
DtVreJoystickControlleroperator= (const DtVreJoystickController &orig)
 

Member Typedef Documentation

◆ OutputPortMap

using makVre::DtVreJoystickController::OutputPortMap = std::map<std::string, DtOutputPort*>
protected

Type definition for mapping port names to port objects.

Constructor & Destructor Documentation

◆ DtVreJoystickController() [1/3]

makVre::DtVreJoystickController::DtVreJoystickController ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc,
DtReaderWriterRegistry * parentRegistry = 0 )

Constructor.

Parameters
nameThe name of this component
ownerThe local object that owns this component
simManagerThe simulation services manager
descComponent descriptor with configuration parameters
parentRegistryOptional parent registry for reader/writer functionality

Creates a new joystick controller component with the specified parameters. The descriptor contains configuration information for setting up appropriate output ports based on the controlled entity type.

Referenced by DtVreJoystickController(), makVre::DtVreTurretJoystickController::DtVreTurretJoystickController(), and operator=().

◆ ~DtVreJoystickController()

virtual makVre::DtVreJoystickController::~DtVreJoystickController ( )
overridevirtual

Virtual destructor.

Cleans up resources used by the joystick controller component, including output ports and port groups.

◆ DtVreJoystickController() [2/3]

makVre::DtVreJoystickController::DtVreJoystickController ( )
private

Default constructor (not implemented)

Default constructor is private and not implemented to prevent creation of instances without proper initialization.

◆ DtVreJoystickController() [3/3]

makVre::DtVreJoystickController::DtVreJoystickController ( const DtVreJoystickController & orig)
private

Copy constructor (not implemented)

Copy constructor is private and not implemented to prevent copy construction.

References DtVreJoystickController().

Member Function Documentation

◆ type()

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

Gets the type identifier for this component.

Returns
String identifying the component type (DtVreJoystickControllerType)

Implements the DtSimComponent::type() method to return the type identifier for this component.

Reimplemented in makVre::DtVreTurretJoystickController.

◆ init()

virtual bool makVre::DtVreJoystickController::init ( )
overridevirtual

Initializes the joystick controller.

Returns
True if initialization is successful, false otherwise

Performs initial setup of the joystick controller, including creating port groups and ports for joystick inputs. This method is called during component initialization.

◆ createPortGroups()

virtual bool makVre::DtVreJoystickController::createPortGroups ( )
overridevirtual

Creates output port groups for joystick inputs.

Returns
True if port groups are successfully created, false otherwise

Creates and initializes the output port groups needed for joystick control. These port groups organize the output ports by function (movement controls, weapon controls, etc.) for proper routing to other components.

◆ createPorts()

virtual bool makVre::DtVreJoystickController::createPorts ( )
overridevirtual

Creates output ports for joystick inputs.

Returns
True if ports are successfully created, false otherwise

Creates and initializes the output ports needed for joystick control. These ports transmit joystick input values to other components that handle actual entity movement and actions.

Reimplemented in makVre::DtVreTurretJoystickController.

◆ creator()

static DtSimComponent * makVre::DtVreJoystickController::creator ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc = 0,
DtReaderWriterRegistry * parentRegistry = 0 )
static

Factory method to create a new instance of this component.

Parameters
nameThe name for the new component
ownerThe local object that will own this component
simManagerThe simulation services manager
descOptional component descriptor
parentRegistryOptional parent registry for reader/writer functionality
Returns
Pointer to the newly created component

Static factory method used by the component creation system to instantiate new instances of this component type.

◆ operator=()

DtVreJoystickController & makVre::DtVreJoystickController::operator= ( const DtVreJoystickController & orig)
private

Assignment operator (not implemented)

Returns
Reference to this object

Assignment operator is private and not implemented to prevent assignment.

References DtVreJoystickController().

◆ handleCommanderOverride()

virtual DtVreMessageResult makVre::DtVreJoystickController::handleCommanderOverride ( DtVreMessage * msg)
protectedvirtual

Handles commander override messages.

Parameters
msgThe message containing override parameters
Returns
Message processing result indicating success or failure

Processes CommanderOverride messages, which activate or deactivate commander override mode. When in commander override mode, direct control inputs take precedence over AI control or other input methods.

◆ calcAndSetPortValues()

virtual void makVre::DtVreJoystickController::calcAndSetPortValues ( const DtString & functionGroup,
const DtString & function,
double value,
bool repeat )
overrideprotectedvirtual

Calculates and sets port values based on function input.

Parameters
functionGroupThe function group identifier
functionThe specific function name
valueThe input value to process
repeatFlag indicating whether the function should repeat

Processes input from joystick functions and applies the appropriate transforms to set the corresponding output port values. This is the main method for translating joystick inputs to simulation control values.

Reimplemented in makVre::DtVreTurretJoystickController.

◆ joystickConnected()

virtual void makVre::DtVreJoystickController::joystickConnected ( )
overrideprotectedvirtual

Handles joystick connection events.

Called when a joystick is connected to the system. Updates internal state and performs any necessary setup to begin processing joystick inputs.

◆ joystickDisconnected()

virtual void makVre::DtVreJoystickController::joystickDisconnected ( )
overrideprotectedvirtual

Handles joystick disconnection events.

Called when a joystick is disconnected from the system. Updates internal state and performs any necessary cleanup to handle the loss of joystick input.

◆ tick()

virtual void makVre::DtVreJoystickController::tick ( )
overrideprotectedvirtual

Updates the controller state each simulation frame.

Processes joystick inputs and updates output port values during each simulation frame. This ensures that the entity's behavior reflects the current joystick state.

Member Data Documentation

◆ myOutputPortGroupName

std::string makVre::DtVreJoystickController::myOutputPortGroupName
protected

Name of the output port group.

Stores the name of the output port group used for organizing joystick control output ports.

◆ myOutputGroup

DtOutputPortGroup* makVre::DtVreJoystickController::myOutputGroup
protected

Pointer to the output port group.

Contains all the output ports used to transmit joystick control values.

◆ myOutputPorts

OutputPortMap makVre::DtVreJoystickController::myOutputPorts
protected

Map of output ports indexed by name.

Stores all output ports created for joystick control, indexed by their names for easy access when updating port values.

◆ myCommanderOverrideActive

bool makVre::DtVreJoystickController::myCommanderOverrideActive
protected

Flag indicating whether commander override mode is active.

When true, indicates that commander override mode is active, which gives direct control inputs precedence over AI control or other input methods.


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