Odyssey::ActionMapInputAdapter Class Reference

Implementation of Action mapping. More...

#include <ActionMapInputAdapter.h>

Inheritance diagram for Odyssey::ActionMapInputAdapter:

Odyssey::InputAdapter List of all members.

Public Types

typedef boost::tuples::tuple<
InputAdapter *, Callable,
InputAdapterPtr
FilterActionTuple
typedef std::map< String,
FilterActionTuple
CallableMap
typedef std::map< String,
Odyssey::Variable
AttributeMap
typedef ContainerIterator<
AttributeMap
AttributeIterator
typedef ConstContainerIterator<
AttributeMap
ConstAttributeIterator

Public Member Functions

 ActionMapInputAdapter ()
 Constructs an empty instance.
bool containsFilterAction (const String &name) const
 Returns true if a filter-action pair exists with the given name.
void setFilterAction (const String &name, InputAdapter *filter, const Callable &action, bool manage=true)
 Sets a new callable pair (a filter and an action).
void setFilterAction (const String &name, InputAdapterPtr filter, const Callable &action)
void setFilter (const String &name, InputAdapter *filter, bool manage=true)
 Sets just the filter.
void setFilter (const String &name, InputAdapterPtr filter)
void setAction (const String &name, const Callable &action)
 Sets just the action.
void removeFilterAction (const String &name)
 Removes a named filter action pair.
void clearFilterActions ()
 Removes all the filter action pairs.
void setAttribute (const String &name, const Variable &attr)
 Sets an attribute for the adapter.
Variable getAttribute (const String &name) const
 Gets an attribute for the adapter.
void removeAttribute (const String &name)
 Removes an attribute.
void clearAttributes ()
 Clears all attributes.
size_t getAttributeCount () const
 Returns the number of stored attributes.
AttributeIterator getAttributeIterator ()
 Returns an iterator over the stored attributes.
ConstAttributeIterator getAttributeIterator () const
 Returns an iterator over the stored attributes.
bool keyPressed (const OIS::KeyEvent &evt)
 Called when a key is pressed on the keyboard.
bool keyReleased (const OIS::KeyEvent &evt)
 Called when a key is released on the keyboard.
bool mouseMoved (const OIS::MouseEvent &evt)
 Called when the mouse is moved.
bool mousePressed (const OIS::MouseEvent &evt, OIS::MouseButtonID id)
 Called when a mouse button is pressed.
bool mouseReleased (const OIS::MouseEvent &evt, OIS::MouseButtonID id)
 Called when a mouse button is released.
bool buttonPressed (const OIS::JoyStickEvent &evt, int id)
 Called when a joystick button is pressed.
bool buttonReleased (const OIS::JoyStickEvent &evt, int id)
 Called when a joystick button is released.
bool axisMoved (const OIS::JoyStickEvent &evt, int axis)
 Called when a joystick axis is moved.
bool povMoved (const OIS::JoyStickEvent &evt, int axis)
 Called when the pov hat on a joystick is moved.

Protected Attributes

CallableMap _callables
AttributeMap _attributes

Detailed Description

Implementation of Action mapping.

This class implements InputAdapter and calls "filters" (which are InputAdapters) to decide whether an "action" (a 1-arity Callable for action name) should be executed. It also stores named attributes, which can be keyed to filter action pair names, or not.


Member Typedef Documentation

typedef ContainerIterator<AttributeMap> Odyssey::ActionMapInputAdapter::AttributeIterator
 

typedef std::map<String,Odyssey::Variable> Odyssey::ActionMapInputAdapter::AttributeMap
 

typedef std::map<String,FilterActionTuple> Odyssey::ActionMapInputAdapter::CallableMap
 

typedef ConstContainerIterator<AttributeMap> Odyssey::ActionMapInputAdapter::ConstAttributeIterator
 

typedef boost::tuples::tuple<InputAdapter*,Callable,InputAdapterPtr> Odyssey::ActionMapInputAdapter::FilterActionTuple
 


Constructor & Destructor Documentation

Odyssey::ActionMapInputAdapter::ActionMapInputAdapter  ) 
 

Constructs an empty instance.


Member Function Documentation

bool Odyssey::ActionMapInputAdapter::axisMoved const OIS::JoyStickEvent &  evt,
int  axis
[virtual]
 

Called when a joystick axis is moved.

Reimplemented from Odyssey::InputAdapter.

bool Odyssey::ActionMapInputAdapter::buttonPressed const OIS::JoyStickEvent &  evt,
int  id
[virtual]
 

Called when a joystick button is pressed.

Reimplemented from Odyssey::InputAdapter.

bool Odyssey::ActionMapInputAdapter::buttonReleased const OIS::JoyStickEvent &  evt,
int  id
[virtual]
 

Called when a joystick button is released.

Reimplemented from Odyssey::InputAdapter.

void Odyssey::ActionMapInputAdapter::clearAttributes  ) 
 

Clears all attributes.

void Odyssey::ActionMapInputAdapter::clearFilterActions  ) 
 

Removes all the filter action pairs.

bool Odyssey::ActionMapInputAdapter::containsFilterAction const String name  )  const
 

Returns true if a filter-action pair exists with the given name.

Variable Odyssey::ActionMapInputAdapter::getAttribute const String name  )  const
 

Gets an attribute for the adapter.

size_t Odyssey::ActionMapInputAdapter::getAttributeCount  )  const
 

Returns the number of stored attributes.

ConstAttributeIterator Odyssey::ActionMapInputAdapter::getAttributeIterator  )  const
 

Returns an iterator over the stored attributes.

AttributeIterator Odyssey::ActionMapInputAdapter::getAttributeIterator  ) 
 

Returns an iterator over the stored attributes.

bool Odyssey::ActionMapInputAdapter::keyPressed const OIS::KeyEvent &  evt  )  [virtual]
 

Called when a key is pressed on the keyboard.

Reimplemented from Odyssey::InputAdapter.

bool Odyssey::ActionMapInputAdapter::keyReleased const OIS::KeyEvent &  evt  )  [virtual]
 

Called when a key is released on the keyboard.

Reimplemented from Odyssey::InputAdapter.

bool Odyssey::ActionMapInputAdapter::mouseMoved const OIS::MouseEvent &  evt  )  [virtual]
 

Called when the mouse is moved.

Reimplemented from Odyssey::InputAdapter.

bool Odyssey::ActionMapInputAdapter::mousePressed const OIS::MouseEvent &  evt,
OIS::MouseButtonID  id
[virtual]
 

Called when a mouse button is pressed.

Reimplemented from Odyssey::InputAdapter.

bool Odyssey::ActionMapInputAdapter::mouseReleased const OIS::MouseEvent &  evt,
OIS::MouseButtonID  id
[virtual]
 

Called when a mouse button is released.

Reimplemented from Odyssey::InputAdapter.

bool Odyssey::ActionMapInputAdapter::povMoved const OIS::JoyStickEvent &  evt,
int  axis
[virtual]
 

Called when the pov hat on a joystick is moved.

Reimplemented from Odyssey::InputAdapter.

void Odyssey::ActionMapInputAdapter::removeAttribute const String name  ) 
 

Removes an attribute.

void Odyssey::ActionMapInputAdapter::removeFilterAction const String name  ) 
 

Removes a named filter action pair.

void Odyssey::ActionMapInputAdapter::setAction const String name,
const Callable action
 

Sets just the action.

This function sets the action callable for a given named pair. This function will fail silently if there is no pair with the given name.

Parameters:
name the name of the filter action pair
action the action callable to set

void Odyssey::ActionMapInputAdapter::setAttribute const String name,
const Variable attr
 

Sets an attribute for the adapter.

void Odyssey::ActionMapInputAdapter::setFilter const String name,
InputAdapterPtr  filter
 

void Odyssey::ActionMapInputAdapter::setFilter const String name,
InputAdapter filter,
bool  manage = true
 

Sets just the filter.

This function sets the filter callable for a given named pair. This function will fail silently if there is no pair with the given name.

Parameters:
name the name of the filter action pair
filter the filter callable to set
See also:
setFilterAction

void Odyssey::ActionMapInputAdapter::setFilterAction const String name,
InputAdapterPtr  filter,
const Callable action
 

void Odyssey::ActionMapInputAdapter::setFilterAction const String name,
InputAdapter filter,
const Callable action,
bool  manage = true
 

Sets a new callable pair (a filter and an action).

This function sets up a new filter action item.

Parameters:
name the name of the new filter action
filter the filter which will process the inputs
action the action to invoke if the filter returns true


Member Data Documentation

AttributeMap Odyssey::ActionMapInputAdapter::_attributes [protected]
 

CallableMap Odyssey::ActionMapInputAdapter::_callables [protected]
 


The documentation for this class was generated from the following file:
Generated on Sun Jan 7 01:18:52 2007 for Odyssey Meta-Engine by  doxygen 1.4.6-NO