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>
|
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| |
◆ OutputPortMap
Type definition for mapping port names to port objects.
◆ DtVreJoystickController() [1/3]
| makVre::DtVreJoystickController::DtVreJoystickController |
( |
const DtString & | name, |
|
|
DtLocalObject * | owner, |
|
|
DtSimulationServices * | simManager, |
|
|
DtComponentDescriptor * | desc, |
|
|
DtReaderWriterRegistry * | parentRegistry = 0 ) |
Constructor.
- Parameters
-
| name | The name of this component |
| owner | The local object that owns this component |
| simManager | The simulation services manager |
| desc | Component descriptor with configuration parameters |
| parentRegistry | Optional 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]
Copy constructor (not implemented)
Copy constructor is private and not implemented to prevent copy construction.
References DtVreJoystickController().
◆ 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
-
| name | The name for the new component |
| owner | The local object that will own this component |
| simManager | The simulation services manager |
| desc | Optional component descriptor |
| parentRegistry | Optional 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=()
Assignment operator (not implemented)
- Returns
- Reference to this object
Assignment operator is private and not implemented to prevent assignment.
References DtVreJoystickController().
◆ handleCommanderOverride()
Handles commander override messages.
- Parameters
-
| msg | The 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
-
| functionGroup | The function group identifier |
| function | The specific function name |
| value | The input value to process |
| repeat | Flag 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.
◆ 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
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: