VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Public Types | Public Member Functions | List of all members
VirtualController Class Reference

Software represention and state capable of describing almost all physical controllers. More...

Public Types

enum  SupportedAsFlag { NO_SUPPORT = 0x00, BINARY_ACTION = 0x01, UNIT_INTERVAL_ACTION = 0x02, SYMMETRIC_UNIT_INTERVAL_ACTION = 0x04 }
 Flags to specify how an action is supported (i.e. what data can be retrieved for it). More...
 

Public Member Functions

 VirtualController (int deviceId)
 Constructs a VirtualController with the specified deviceId. More...
 
void setJoystickAxisScheme (const JoystickAxisScheme &joystickAxisScheme)
 Sets the VirtualController's JoystickAxisScheme. More...
 
void setKeyScheme (const KeyScheme &keyScheme)
 Sets the VirtualController's KeyScheme. More...
 
void setTriggerAxisScheme (const TriggerAxisScheme &triggerAxisScheme)
 Sets the VirtualController's TriggerAxisScheme. More...
 
int getDeviceId () const
 Returns the VirtualController's device identifier. More...
 
bool isSourceOfEvent (ControllerEvent *event) const
 Returns whether or not this VirtualController, and the device it abstracts, is the source of event. More...
 
virtual bool onControllerEvent (ControllerEvent *event)
 Notifies the VirtualController of the event. More...
 
virtual int getActionSupport (const InputScheme<>::Action &action) const
 Returns the VirtualController's type of support for action (as a set of flags). More...
 
virtual bool isActionActivated (const InputScheme<>::Action &action) const
 Returns whether or not action is "activated" (i.e. the binary value of the action). More...
 
virtual float getActionUnitIntervalValue (const InputScheme<>::Action &action) const
 Returns the [0.0f, 1.0f] unit interval value for action. More...
 
virtual float getActionSymmetricUnitIntervalValue (const InputScheme<>::Action &action) const
 Returns the [-1.0f, 1.0f] symmetric unit interval value for action. More...
 

Detailed Description

Software represention and state capable of describing almost all physical controllers.

Specifically, a VirtualController represents the state of any controller whose input capabilities can be specified in a ControllerEvent. Furthermore, this abstraction stores the state of higher-level, pre-specified actions as opposed to lower level event data.

Member Enumeration Documentation

Flags to specify how an action is supported (i.e. what data can be retrieved for it).

Enumerator
NO_SUPPORT 

Action is unsupported.

BINARY_ACTION 

Action is binary (i.e. can be "on/off").

UNIT_INTERVAL_ACTION 

Action has a normalized [0.0f, 1.0f] real value.

SYMMETRIC_UNIT_INTERVAL_ACTION 

Action has a bipolar [-1.0f, 1.0f] real value.

Constructor & Destructor Documentation

VirtualController::VirtualController ( int  deviceId)

Constructs a VirtualController with the specified deviceId.

Parameters
deviceIdId to identify the VirtualController

Member Function Documentation

virtual int VirtualController::getActionSupport ( const InputScheme<>::Action &  action) const
virtual

Returns the VirtualController's type of support for action (as a set of flags).

Parameters
actionAction to query the VirtualController's type of support for
virtual float VirtualController::getActionSymmetricUnitIntervalValue ( const InputScheme<>::Action &  action) const
virtual

Returns the [-1.0f, 1.0f] symmetric unit interval value for action.

Parameters
actionAction to query for symmetric unit interval value
virtual float VirtualController::getActionUnitIntervalValue ( const InputScheme<>::Action &  action) const
virtual

Returns the [0.0f, 1.0f] unit interval value for action.

Parameters
actionAction to query for unit interval value
int VirtualController::getDeviceId ( ) const
inline

Returns the VirtualController's device identifier.

virtual bool VirtualController::isActionActivated ( const InputScheme<>::Action &  action) const
virtual

Returns whether or not action is "activated" (i.e. the binary value of the action).

Parameters
actionAction to query for binary value
bool VirtualController::isSourceOfEvent ( ControllerEvent event) const

Returns whether or not this VirtualController, and the device it abstracts, is the source of event.

Parameters
eventControllerEvent to check source of
virtual bool VirtualController::onControllerEvent ( ControllerEvent event)
virtual

Notifies the VirtualController of the event.

Returns
true if event was handled by this VirtualController.
Parameters
eventControllerEvent to process
void VirtualController::setJoystickAxisScheme ( const JoystickAxisScheme joystickAxisScheme)

Sets the VirtualController's JoystickAxisScheme.

Parameters
joystickAxisSchemeJoystickAxisScheme to use
void VirtualController::setKeyScheme ( const KeyScheme keyScheme)

Sets the VirtualController's KeyScheme.

Parameters
keySchemeKeyScheme to use
void VirtualController::setTriggerAxisScheme ( const TriggerAxisScheme triggerAxisScheme)

Sets the VirtualController's TriggerAxisScheme.

Parameters
triggerAxisSchemeTriggerAxisScheme to use