VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Public Member Functions | Static Public Attributes | List of all members
GamepadRouter::GamepadControllerFactory Class Reference

Factory for constructing VirtualControllers to represent gamepad devices as controllers. More...

Inheritance diagram for GamepadRouter::GamepadControllerFactory:
ControllerFactory

Public Member Functions

 GamepadControllerFactory (const KeyScheme &keyScheme, const JoystickAxisScheme &joystickAxisScheme, const TriggerAxisScheme &triggerAxisScheme)
 Constructs a GamepadControllerFactory from input schemes. More...
 
virtual VirtualControllercreateNewController (int deviceId) const override
 Returns a new VirtualController for the specified deviceId. More...
 
virtual bool intersects (const ControllerFactory &otherFactory) const override
 Returns whether or not this ControllerFactory intersects (i.e. overlaps input schemes) with the specified ControllerFactory. More...
 
bool intersects (const GamepadControllerFactory &otherFactory) const
 Returns whether or not this GamepadControllerFactory intersects (i.e. overlaps input schemes) with the specified GamepadControllerFactory. More...
 
virtual bool handlesControllerEvent (const ControllerEvent *event) const override
 Returns whether or not this ControllerFactory can process the specified event. More...
 

Static Public Attributes

static std::set< KeyCodesValidKeyCodes
 Set of KeyCodes valid as input on a gamepad. More...
 
static std::set< JoystickAxisCodesValidJoystickAxisCodes
 Set of JoystickAxisCodes valid as input on a gamepad. More...
 
static std::set< TriggerAxisCodesValidTriggerAxisCodes
 Set of TriggerAxisCodes valid as input on a gamepad. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ControllerFactory
template<typename Input >
static bool isValidInputScheme (const InputScheme< Input > &scheme, std::set< Input > &validInputs)
 Returns whether or not the given InputScheme is valid (i.e. only contains input mappings which are valid) according to the specified validation set. More...
 

Detailed Description

Factory for constructing VirtualControllers to represent gamepad devices as controllers.

Constructor & Destructor Documentation

GamepadRouter::GamepadControllerFactory::GamepadControllerFactory ( const KeyScheme keyScheme,
const JoystickAxisScheme joystickAxisScheme,
const TriggerAxisScheme triggerAxisScheme 
)
explicit

Constructs a GamepadControllerFactory from input schemes.

Parameters
keySchemeKeyScheme for constructed VirtualControllers
joystickAxisSchemeJoystickAxisScheme for constructed VirtualControllers
triggerAxisSchemeTriggerAxisScheme for constructed VirtualControllers

Member Function Documentation

virtual VirtualController* GamepadRouter::GamepadControllerFactory::createNewController ( int  deviceId) const
overridevirtual

Returns a new VirtualController for the specified deviceId.

Parameters
deviceIdId to identify the constructed VirtualController

Implements ControllerFactory.

virtual bool GamepadRouter::GamepadControllerFactory::handlesControllerEvent ( const ControllerEvent event) const
overridevirtual

Returns whether or not this ControllerFactory can process the specified event.

Parameters
eventControllerEvent to check for affinity with this ControllerFactory

Implements ControllerFactory.

virtual bool GamepadRouter::GamepadControllerFactory::intersects ( const ControllerFactory otherFactory) const
overridevirtual

Returns whether or not this ControllerFactory intersects (i.e. overlaps input schemes) with the specified ControllerFactory.

Note
Two ControllerFactorys would be intersecting if both would return true for handlesControllerEvent() when passed the same event.
Parameters
otherFactoryControllerFactory to test for intersection with this

Implements ControllerFactory.

bool GamepadRouter::GamepadControllerFactory::intersects ( const GamepadControllerFactory otherFactory) const

Returns whether or not this GamepadControllerFactory intersects (i.e. overlaps input schemes) with the specified GamepadControllerFactory.

Note
Two GamepadControllerFactorys would be intersecting if both would return true for handlesControllerEvent() when passed the same event.
Parameters
otherFactoryGamepadControllerFactory to test for intersection with this

Member Data Documentation

std::set<JoystickAxisCode> GamepadRouter::GamepadControllerFactory::sValidJoystickAxisCodes
static

Set of JoystickAxisCodes valid as input on a gamepad.

std::set<KeyCode> GamepadRouter::GamepadControllerFactory::sValidKeyCodes
static

Set of KeyCodes valid as input on a gamepad.

std::set<TriggerAxisCode> GamepadRouter::GamepadControllerFactory::sValidTriggerAxisCodes
static

Set of TriggerAxisCodes valid as input on a gamepad.