#include <ActionManager.hpp>
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::Logger * | m_pLogger |
Pointer to the logger to be used. | |
KeyboardHandler * | m_pKeyboardHandler |
Keyboard handler. | |
MouseHandler * | m_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... |
This is the object responsible of associating inputs to actions. These actions are identified by a unique integer.
syBR::InputCore::ActionManager::ActionManager | ( | Core::Logger * | pLogger | ) |
Constructor.
pLogger | Pointer to the instance of the logger to use |
syBR::InputCore::ActionManager::~ActionManager | ( | ) | [virtual] |
Destructor.
void syBR::InputCore::ActionManager::setKeyboardHandler | ( | KeyboardHandler * | pKeyboardHandler | ) |
Set the keyboard handler to be used for keyboard inputs.
pKeyboardHandler | Keyboard handler to use |
void syBR::InputCore::ActionManager::setMouseHandler | ( | MouseHandler * | pMouseHandler | ) |
Set the mouse handler to be used for mouse inputs.
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.
id | Identifier of the action | |
defaultValue | Value associated to the action | |
defaultValueState | State of the value needed to trigger to action. |
bool syBR::InputCore::ActionManager::reAssignAction | ( | unsigned int | id, | |
ActionCode | value, | |||
ActionState | valueState | |||
) |
Re-assign the input value and the state of an existing action.
id | Identifier of the action | |
value | Value associated to the action | |
valueState | State of the value needed to trigger to action. |
const bool syBR::InputCore::ActionManager::actionTriggered | ( | const unsigned int | id | ) | const |
Check if an action has been triggered.
id | Identifier of the action |
const int syBR::InputCore::ActionManager::getPointerPosition | ( | const unsigned int | axis, | |
const bool | relative | |||
) | const |
Get the position of the pointer along an axis.
axis | 0 for x-axis, 1 for y-axis and 2 for z-axis (wheel) | |
relative | One of these:
|
Core::Logger* syBR::InputCore::ActionManager::m_pLogger [protected] |
Pointer to the logger to be used.
Keyboard handler.
Mouse handler.
std::map<unsigned int, std::pair<ActionCode, ActionState> > syBR::InputCore::ActionManager::m_mapActions [protected] |
List of declared actions.
Copyright © 2008 by Sebastien Frippiat
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:34 2008