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

Detailed Description

DtBallisticGunJoyController extends the DtBallisticGunController class with the ability to be controlled from a joystick. It implements the DtJoystickControllerInterface to process joystick input and translate it to appropriate gun control outputs.

Uses Descriptor Type: DtBallisticGunJoyControllerDescriptor

#include <ballisticGunJoyController.h>

Inheritance diagram for makVre::DtBallisticGunJoyController:
[legend]

Public Member Functions

 DtBallisticGunJoyController (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc, DtReaderWriterRegistry *const parentRegistry=0)
 
virtual ~DtBallisticGunJoyController () override
 
virtual const char * type () const override
 
virtual bool createActiveJoystickPort ()
 
virtual DtBooleanOutputPort * activeJoystickPort () const
 
virtual bool createElevationPort ()
 
virtual DtConstrainedAnalogOutputPort * elevationPort () const
 
virtual bool chooseAmmo (const DtEntityType &name=DtEntityType::nullType())
 
virtual bool canFire ()
 

Static Public Member Functions

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

Protected Member Functions

virtual void tick () override
 
virtual void calcAndSetPortValues (const DtString &functionGroup, const DtString &function, double value, bool repeat) override
 
virtual void joystickConnected () override
 
virtual void joystickDisconnected () override
 
virtual bool createPorts () override
 

Protected Attributes

bool myFiring
 
bool myFireButtonDown
 
Ports and Port Groups
DtConstrainedAnalogOutputPort * myElevationPort
 
DtBooleanOutputPort * myActiveJoystickPort
 

Private Member Functions

 DtBallisticGunJoyController ()
 
 DtBallisticGunJoyController (const DtBallisticGunJoyController &orig)
 
const DtBallisticGunJoyControlleroperator= (const DtBallisticGunJoyController &orig)
 

Constructor & Destructor Documentation

◆ DtBallisticGunJoyController() [1/3]

makVre::DtBallisticGunJoyController::DtBallisticGunJoyController ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc,
DtReaderWriterRegistry *const 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 ballistic gun joy controller component with the specified parameters.

Referenced by DtBallisticGunJoyController(), and operator=().

◆ ~DtBallisticGunJoyController()

virtual makVre::DtBallisticGunJoyController::~DtBallisticGunJoyController ( )
overridevirtual

Virtual destructor.

Cleans up resources used by the ballistic gun joy controller component.

◆ DtBallisticGunJoyController() [2/3]

makVre::DtBallisticGunJoyController::DtBallisticGunJoyController ( )
private

Default constructor (not implemented)

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

◆ DtBallisticGunJoyController() [3/3]

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

Copy constructor (not implemented)

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

References DtBallisticGunJoyController().

Member Function Documentation

◆ type()

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

Gets the type identifier for this component.

Returns
String identifying the component type (DtBallisticGunJoyControllerType)

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

Reimplemented in makVre::DtVreBallisticGunJoyController.

◆ createActiveJoystickPort()

virtual bool makVre::DtBallisticGunJoyController::createActiveJoystickPort ( )
virtual

Creates the joystick active state output port.

Returns
True if port was created successfully, false otherwise

Creates the output port used to indicate when joystick control is active. This is called during initialization to set up communication with the actuator.

◆ activeJoystickPort()

virtual DtBooleanOutputPort * makVre::DtBallisticGunJoyController::activeJoystickPort ( ) const
virtual

Gets the joystick active state output port.

Returns
Pointer to the joystick active output port

Provides access to the port that indicates when joystick control is active.

◆ createElevationPort()

virtual bool makVre::DtBallisticGunJoyController::createElevationPort ( )
virtual

Creates the elevation control output port.

Returns
True if port was created successfully, false otherwise

Creates the output port used to control gun elevation via joystick input.

◆ elevationPort()

virtual DtConstrainedAnalogOutputPort * makVre::DtBallisticGunJoyController::elevationPort ( ) const
virtual

Gets the elevation control output port.

Returns
Pointer to the elevation output port

Provides access to the port that controls gun elevation.

◆ chooseAmmo()

virtual bool makVre::DtBallisticGunJoyController::chooseAmmo ( const DtEntityType & name = DtEntityType::nullType())
virtual

Selects ammunition type for the weapon.

Parameters
nameThe entity type of ammunition to select, or null for default
Returns
True if ammunition selection was successful, false otherwise

Attempts to select the specified ammunition type for the weapon. If no type is specified (nullType), uses the default ammunition.

◆ canFire()

virtual bool makVre::DtBallisticGunJoyController::canFire ( )
virtual

Checks if the weapon can currently fire.

Returns
True if the weapon can fire, false otherwise

Determines whether the weapon is currently able to fire based on ammunition availability and other weapon state conditions.

◆ creator()

static DtSimComponent * makVre::DtBallisticGunJoyController::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.

◆ tick()

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

Updates the controller state each simulation frame.

Processes joystick input and updates output ports to control the associated ballistic gun actuator component.

Reimplemented in makVre::DtVreBallisticGunJoyController.

◆ calcAndSetPortValues()

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

Processes joystick input and updates output ports.

Parameters
functionGroupThe function group identifier for the input
functionThe specific function identifier within the group
valueThe input value from the joystick
repeatFlag indicating if this is a repeated input

Implements the DtJoystickControllerInterface method to process joystick input and update the controller's output ports accordingly.

◆ joystickConnected()

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

Handles joystick connection event.

Called when a joystick is connected to the system. Activates joystick control mode for this controller.

◆ joystickDisconnected()

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

Handles joystick disconnection event.

Called when a joystick is disconnected from the system. Deactivates joystick control mode for this controller.

◆ createPorts()

virtual bool makVre::DtBallisticGunJoyController::createPorts ( )
overrideprotectedvirtual

Creates all required output ports for this controller.

Returns
True if all ports were created successfully, false otherwise

Overridden to create the specific output ports needed by this controller, including elevation control and joystick active state ports.

◆ operator=()

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

Assignment operator (not implemented)

Returns
Reference to this object

Assignment operator is private and not implemented to prevent assignment.

References DtBallisticGunJoyController().

Member Data Documentation

◆ myElevationPort

DtConstrainedAnalogOutputPort* makVre::DtBallisticGunJoyController::myElevationPort
protected

Output Port Name: elevation
Output Port Description:
Output Port Range: -1. to 1.
Output Port Default Value:
Output Group Parent:

◆ myActiveJoystickPort

DtBooleanOutputPort* makVre::DtBallisticGunJoyController::myActiveJoystickPort
protected

Output Port Name: joystick-active
Output Port Description: Indicates whether controller behavior is being executed through a joystick.
Output Port Range:
Output Port Default Value: false
Output Group Parent:

◆ myFiring

bool makVre::DtBallisticGunJoyController::myFiring
protected

Flag indicating if the weapon is currently firing.

◆ myFireButtonDown

bool makVre::DtBallisticGunJoyController::myFireButtonDown
protected

Flag indicating if the fire button is currently pressed.


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