VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
ControllerFactory Class Referenceabstract

Base interface for constructing virtual controllers from a deviceId. More...

Inheritance diagram for ControllerFactory:
GamepadRouter::GamepadControllerFactory KeyboardRouter::KeyboardControllerFactory TouchNavigationRouter::TouchNavigationControllerFactory

Public Member Functions

virtual VirtualControllercreateNewController (int deviceId) const =0
 Returns a new VirtualController for the specified deviceId. More...
 
virtual bool intersects (const ControllerFactory &otherFactory) const =0
 Returns whether or not this ControllerFactory intersects (i.e. overlaps input schemes) with the specified ControllerFactory. More...
 
virtual bool handlesControllerEvent (const ControllerEvent *event) const =0
 Returns whether or not this ControllerFactory can process the specified event. More...
 

Static Public Member Functions

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

Base interface for constructing virtual controllers from a deviceId.

In essence, classes that derive from this interface implicitly define controller types by specifying the particular input schemes supported by that controller type. Furthermore, factories act as an encapsulation of component input schemes that comprise a controller.

Member Function Documentation

virtual VirtualController* ControllerFactory::createNewController ( int  deviceId) const
pure virtual

Returns a new VirtualController for the specified deviceId.

Parameters
deviceIdId to identify the constructed VirtualController

Implemented in KeyboardRouter::KeyboardControllerFactory, GamepadRouter::GamepadControllerFactory, and TouchNavigationRouter::TouchNavigationControllerFactory.

virtual bool ControllerFactory::handlesControllerEvent ( const ControllerEvent event) const
pure virtual

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

Parameters
eventControllerEvent to check for affinity with this ControllerFactory

Implemented in GamepadRouter::GamepadControllerFactory, TouchNavigationRouter::TouchNavigationControllerFactory, and KeyboardRouter::KeyboardControllerFactory.

virtual bool ControllerFactory::intersects ( const ControllerFactory otherFactory) const
pure virtual

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

Implemented in GamepadRouter::GamepadControllerFactory, TouchNavigationRouter::TouchNavigationControllerFactory, and KeyboardRouter::KeyboardControllerFactory.

template<typename Input >
static bool ControllerFactory::isValidInputScheme ( const InputScheme< Input > &  scheme,
std::set< Input > &  validInputs 
)
inlinestatic

Returns whether or not the given InputScheme is valid (i.e. only contains input mappings which are valid) according to the specified validation set.

Parameters
schemeInputScheme to validate
validInputsSet of inputs to validate all inputs in the InputScheme against