syBR::InputCore::ActionManager Class Reference

Base input system class. More...

#include <ActionManager.hpp>

List of all members.

Public Types

enum  ActionState { AS_KEY_DOWN = 0, AS_KEY_UP = 1, AS_MOUSE_BUTTON_DOWN = 2, AS_MOUSE_BUTTON_UP = 3 }
 State of an action code. More...

Public Member Functions

 ActionManager (Core::Logger *pLogger)
 Constructor.
virtual ~ActionManager ()
 Destructor.
void setKeyboardHandler (KeyboardHandler *pKeyboardHandler)
 Set the keyboard handler to be used for keyboard inputs.
void setMouseHandler (MouseHandler *pMouseHandler)
 Set the mouse handler to be used for mouse inputs.
bool declareAction (unsigned int id, ActionCode defaultValue, ActionState defaultValueState)
 Declare an action and its default associated input value and state.
bool reAssignAction (unsigned int id, ActionCode value, ActionState valueState)
 Re-assign the input value and the state of an existing action.
const bool actionTriggered (const unsigned int id) const
 Check if an action has been triggered.
const int getPointerPosition (const unsigned int axis, const bool relative) const
 Get the position of the pointer along an axis.

Protected Attributes

Core::Loggerm_pLogger
 Pointer to the logger to be used.
KeyboardHandlerm_pKeyboardHandler
 Keyboard handler.
MouseHandlerm_pMouseHandler
 Mouse handler.
std::map< unsigned
int, std::pair
< ActionCode,
ActionState > > 
m_mapActions
 List of declared actions.

Classes

union  ActionCode
 Key code or mouse button associated with an action. More...


Detailed Description

Base input system class.

This is the object responsible of associating inputs to actions. These actions are identified by a unique integer.


Member Enumeration Documentation

enum syBR::InputCore::ActionManager::ActionState

State of an action code.

Enumerator:
AS_KEY_DOWN  Key must be down.
AS_KEY_UP  Key must be up.
AS_MOUSE_BUTTON_DOWN  Mouse button must be down.
AS_MOUSE_BUTTON_UP  Mouse button must be up.


Constructor & Destructor Documentation

syBR::InputCore::ActionManager::ActionManager ( Core::Logger pLogger  ) 

Constructor.

Parameters:
pLogger Pointer to the instance of the logger to use

syBR::InputCore::ActionManager::~ActionManager (  )  [virtual]

Destructor.


Member Function Documentation

void syBR::InputCore::ActionManager::setKeyboardHandler ( KeyboardHandler pKeyboardHandler  ) 

Set the keyboard handler to be used for keyboard inputs.

Parameters:
pKeyboardHandler Keyboard handler to use

void syBR::InputCore::ActionManager::setMouseHandler ( MouseHandler pMouseHandler  ) 

Set the mouse handler to be used for mouse inputs.

Parameters:
pMouseHandler Mouse handler to use

bool syBR::InputCore::ActionManager::declareAction ( unsigned int  id,
ActionCode  defaultValue,
ActionState  defaultValueState 
)

Declare an action and its default associated input value and state.

Parameters:
id Identifier of the action
defaultValue Value associated to the action
defaultValueState State of the value needed to trigger to action.
Returns:
One of those:
  • true in case of success
  • false otherwise

bool syBR::InputCore::ActionManager::reAssignAction ( unsigned int  id,
ActionCode  value,
ActionState  valueState 
)

Re-assign the input value and the state of an existing action.

Parameters:
id Identifier of the action
value Value associated to the action
valueState State of the value needed to trigger to action.
Returns:
One of those:
  • true in case of success
  • false otherwise

const bool syBR::InputCore::ActionManager::actionTriggered ( const unsigned int  id  )  const

Check if an action has been triggered.

Parameters:
id Identifier of the action
Returns:
One of those:
  • true if the action has been triggered
  • false otherwise

const int syBR::InputCore::ActionManager::getPointerPosition ( const unsigned int  axis,
const bool  relative 
) const

Get the position of the pointer along an axis.

Parameters:
axis 0 for x-axis, 1 for y-axis and 2 for z-axis (wheel)
relative One of these:
  • true to return the position relative to the last kwown position
  • false to return the absolute position
Returns:
Position of the pointer along the specified axis


Member Data Documentation

Core::Logger* syBR::InputCore::ActionManager::m_pLogger [protected]

Pointer to the logger to be used.

KeyboardHandler* syBR::InputCore::ActionManager::m_pKeyboardHandler [protected]

Keyboard handler.

MouseHandler* syBR::InputCore::ActionManager::m_pMouseHandler [protected]

Mouse handler.

std::map<unsigned int, std::pair<ActionCode, ActionState> > syBR::InputCore::ActionManager::m_mapActions [protected]

List of declared actions.


The documentation for this class was generated from the following files:

Copyright © 2008 by Sebastien Frippiat
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:34 2008