VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Public Types | Public Member Functions | List of all members
InputScheme< Input > Class Template Referenceabstract

Represents a scheme mapping generic input "events" to output "actions". More...

Public Types

typedef int Action
 Output type. More...
 
typedef std::map< Input, ActionMap
 Input "event" to Action output map. More...
 

Public Member Functions

 InputScheme ()
 Constructs an empty input scheme. More...
 
 InputScheme (const Map &scheme)
 Constructs an InputScheme from the specified input to action map. More...
 
bool empty () const
 Returns whether or not the InputScheme contains any mappings. More...
 
Map::const_iterator begin () const
 Returns a const iterator positioned at the beginning of the InputScheme. More...
 
Map::const_iterator end () const
 Returns a const iterator positioned at the end of the InputScheme. More...
 
bool hasActionFor (const Input &input) const
 Returns whether or not this input scheme has an action associated with the specified input. More...
 
bool intersects (const InputScheme< Input > &inputScheme) const
 Returns whether or not inputScheme intersects with this InputScheme. More...
 
virtual bool handlesControllerEvent (const ControllerEvent *event) const =0
 Returns whether or not this InputScheme would handle event. More...
 

Detailed Description

template<typename Input = int>
class InputScheme< Input >

Represents a scheme mapping generic input "events" to output "actions".

Member Typedef Documentation

template<typename Input = int>
typedef int InputScheme< Input >::Action

Output type.

template<typename Input = int>
typedef std::map<Input, Action> InputScheme< Input >::Map

Input "event" to Action output map.

Constructor & Destructor Documentation

template<typename Input = int>
InputScheme< Input >::InputScheme ( )
inline

Constructs an empty input scheme.

template<typename Input = int>
InputScheme< Input >::InputScheme ( const Map scheme)
inlineexplicit

Constructs an InputScheme from the specified input to action map.

Parameters
schemeMap from which to construct the InputScheme

Member Function Documentation

template<typename Input = int>
Map::const_iterator InputScheme< Input >::begin ( ) const
inline

Returns a const iterator positioned at the beginning of the InputScheme.

template<typename Input = int>
bool InputScheme< Input >::empty ( ) const
inline

Returns whether or not the InputScheme contains any mappings.

template<typename Input = int>
Map::const_iterator InputScheme< Input >::end ( ) const
inline

Returns a const iterator positioned at the end of the InputScheme.

template<typename Input = int>
virtual bool InputScheme< Input >::handlesControllerEvent ( const ControllerEvent event) const
pure virtual

Returns whether or not this InputScheme would handle event.

Parameters
eventControllerEvent to check for information on inputs in this InputScheme

Implemented in JoystickAxisScheme, KeyScheme, and TriggerAxisScheme.

template<typename Input = int>
bool InputScheme< Input >::hasActionFor ( const Input &  input) const
inline

Returns whether or not this input scheme has an action associated with the specified input.

Parameters
inputInput to check for the existence of the associated action
template<typename Input = int>
bool InputScheme< Input >::intersects ( const InputScheme< Input > &  inputScheme) const
inline

Returns whether or not inputScheme intersects with this InputScheme.

Parameters
inputSchemeInputScheme to check for intersection against