Orxonox: orxonox::InputManager Class Reference

# orxonox::InputManager Class Reference

Captures and distributes mouse and keyboard input. More...

`#include <src/core/input/InputManager.h>`

Inheritance diagram for orxonox::InputManager:

List of all members.

## Public Types

enum | InputManagerState { Uninitialised = 0x00, OISReady = 0x01, InternalsReady = 0x02, Ticking = 0x04, Calibrating = 0x08, ReloadRequest = 0x10, JoyStickSupport = 0x20 }

## Public Member Functions

void | clearBuffers ()
| Clears all buffers that store what keys/buttons are being pressed at the moment.
template<class T>
T * | createInputState (const std::string &name, bool bAlwaysGetsInput=false, bool bTransparent=false, InputStatePriority priority=InputStatePriority::Dynamic)
| Creates a new InputState by type, name and priority.
InputState * | getCurrentState ()
| Returns the current input state (there might be others active too!).
InputState * | getState (const std::string &name)
| Returns the pointer to the requested InputState.
void | initialise (size_t windowHnd, int windowWidth, int windowHeight, bool joyStickSupport=true)
| Creates the OIS::InputMananger, the keyboard, the mouse and the joysticks and assigns the key bindings.
| InputManager ()
| Constructor only sets member fields to initial zero values and registers the class in the class hierarchy.
unsigned int | numberOfJoySticks ()
unsigned int | numberOfKeyboards ()
unsigned int | numberOfMice ()
void | reloadInputSystem (bool joyStickSupport=true)
| Public interface. Only reloads immediately if the call stack doesn't include the update() method.
bool | requestDestroyState (const std::string &name)
| Removes and destroys an input state internally.
bool | requestEnterState (const std::string &name)
| Activates a specific input state. It might not be really activated if the priority is too low!
bool | requestLeaveState (const std::string &name)
| Deactivates a specific input state.
void | setKeyDetectorCallback (const std::string &command)
| Sets the the name of the command used by the KeyDetector as callback.
void | setWindowExtents (const int width, const int height)
| Adjusts the mouse window metrics. This method has to be called every time the size of the window changes.
void | update (const Clock &time)
| Updates the states and the InputState situation.
| ~InputManager ()
| Destroys all the created input devices and states.

## Static Public Member Functions

static void | calibrate ()
| Starts joy stick calibration.
static InputManager & | getInstance ()
static InputManager * | getInstancePtr ()
static void | reload (bool joyStickSupport=true)
| Reloads the input system.

## Static Public Attributes

static EmptyHandler | EMPTY_HANDLER
static const unsigned int | sliderAxes = 8

## Private Member Functions

void | _calibrationFileCallback ()
| Callback for the joy stick calibration config file.
void | _clearBuffers ()
void | _completeCalibration ()
bool | _configureInputState (InputState *state, const std::string &name, bool bAlwaysGetsInput, bool bTransparent, int priority)
| Adds a new key handler.
void | _configureJoySticks ()
| Sets the size of all the different lists that are dependent on the number of joy stick devices created and loads the joy stick calibration.
void | _destroyJoySticks ()
| Destroys all the joy sticks and resizes the lists to 0.
void | _destroyKeyboard ()
| Destroys the keyboard and sets it to 0.
void | _destroyMouse ()
| Destroys the mouse and sets it to 0.
void | _destroyState (InputState *state)
| Removes and destroys an InputState.
void | _evaluateCalibration ()
void | _fireAxis (unsigned int iJoyStick, int axis, int value)
| Calls the states for a particular axis with our enumeration. Used by OIS sliders and OIS axes.
unsigned int | _getJoystick (const OIS::JoyStickEvent &arg)
| Returns the joy stick ID (orxonox) according to a OIS::JoyStickEvent.
void | _initialiseJoySticks ()
| Creates all joy sticks and sets the event handler.
void | _initialiseKeyboard ()
| Creates a keyboard and sets the event handler.
void | _initialiseMouse ()
| Creates a mouse and sets the event handler.
void | _loadCalibration ()
void | _reload (bool joyStickSupport)
| Internal reload method. Destroys the OIS devices and loads them again.
void | _startCalibration ()
void | _updateActiveStates ()
| Updates the currently active states (according to activeStates_) for each device. Also, a list of all active states (no duplicates!) is compiled for the general update().
bool | axisMoved (const OIS::JoyStickEvent &arg, int axis)
bool | buttonPressed (const OIS::JoyStickEvent &arg, int button)
bool | buttonReleased (const OIS::JoyStickEvent &arg, int button)
| InputManager (const InputManager &)
bool | keyPressed (const OIS::KeyEvent &arg)
| Event handler for the keyPressed Event.
bool | keyReleased (const OIS::KeyEvent &arg)
| Event handler for the keyReleased Event.
bool | mouseMoved (const OIS::MouseEvent &arg)
| Event handler for the mouseMoved Event.
bool | mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id)
| Event handler for the mousePressed Event.
bool | mouseReleased (const OIS::MouseEvent &arg, OIS::MouseButtonID id)
| Event handler for the mouseReleased Event.
bool | povMoved (const OIS::JoyStickEvent &arg, int id)
| Joystick Event, and povID.
void | setConfigValues ()
| Sets the configurable values.
bool | sliderMoved (const OIS::JoyStickEvent &arg, int id)
| Joystick Event, and sliderID.
bool | vector3Moved (const OIS::JoyStickEvent &arg, int id)
| Joystick Event, and Vector3ID.

## Private Attributes

std::map< int, InputState * > | activeStates_
std::vector< InputState * > | activeStatesTicked_
std::vector< std::vector < InputState * > > | activeStatesTriggered_
std::vector < ConfigValueContainer * > | calibrationConfigValueContainers_
std::string | calibrationFilename_
| Joy stick calibration ini filename.
InputBuffer * | calibratorCallbackBuffer_
unsigned int | devicesNum_
std::map< std::string, InputState * > | inputStatesByName_
OIS::InputManager * | inputSystem_
| OIS input manager.
InputManagerState | internalState_
| Current internal state.
std::vector< std::vector < JoyStickButtonCode::ByEnum > > | joyStickButtonsDown_
std::vector< JoyStickCalibration > | joyStickCalibrations_
std::vector< std::string > | joyStickIDs_
| Execution unique identification strings for the joy sticks.
std::vector< std::vector< int > > | joyStickMaxValues_
std::vector< std::vector< int > > | joyStickMiddleValues_
std::vector< std::vector< int > > | joyStickMinValues_
std::vector< OIS::JoyStick * > | joySticks_
| OIS joy sticks.
unsigned int | joySticksSize_
OIS::Keyboard * | keyboard_
| OIS mouse.
unsigned int | keyboardModifiers_
| Bit mask representing keyboard modifiers.
KeyDetector * | keyDetector_
| KeyDetector instance.
std::vector< Key > | keysDown_
OIS::Mouse * | mouse_
| OIS keyboard.
std::vector < MouseButtonCode::ByEnum > | mouseButtonsDown_
std::vector< POVStates > | povStates_
| Keeps track of the joy stick POV states.
std::vector< SliderStates > | sliderStates_
| Keeps track of the possibly two slider axes.
std::set< InputState * > | stateDestroyRequests_
| Request to destroy a state.
SimpleInputState * | stateEmpty_
std::set< InputState * > | stateEnterRequests_
| Request to enter a new state.
std::set< InputState * > | stateLeaveRequests_
| Request to leave a running state.
size_t | windowHnd_
| Render window handle.

## Static Private Attributes

static InputManager * | singletonRef_s = 0

## Friends

class | ClassIdentifier< InputManager >

## Detailed Description

Captures and distributes mouse and keyboard input.

## Member Enumeration Documentation

enum orxonox::InputManager::InputManagerState

Enumerator:

  Uninitialised |
  OISReady |
  InternalsReady |
  Ticking |
  Calibrating |
  ReloadRequest |
  JoyStickSupport |

## Constructor & Destructor Documentation

orxonox::InputManager::InputManager | ( |  | ) |

Constructor only sets member fields to initial zero values and registers the class in the class hierarchy.

References RegisterRootObject, setConfigValues(), and singletonRef_s.

orxonox::InputManager::~InputManager | ( |  | ) |

Destroys all the created input devices and states.

References _destroyJoySticks(), _destroyKeyboard(), _destroyMouse(), _destroyState(), activeStates_, calibratorCallbackBuffer_, CCOUT, OIS::InputManager::destroyInputSystem(), inputStatesByName_, inputSystem_, internalState_, keyDetector_, requestDestroyState(), singletonRef_s, stateEmpty_, and Uninitialised.

orxonox::InputManager::InputManager | ( | const InputManager & |  | ) | `[private]`

## Member Function Documentation

void orxonox::InputManager::_calibrationFileCallback | ( |  | ) | `[private]`

Callback for the joy stick calibration config file.

See also:
  setConfigValues.

References calibrationFilename_, orxonox::ConfigFileManager::getInstance(), orxonox::ConfigFileType::JoyStickCalibration, and orxonox::ConfigFileManager::setFilename().

Referenced by setConfigValues().

void orxonox::InputManager::_clearBuffers | ( |  | ) | `[private]`

References joyStickButtonsDown_, joySticksSize_, keyboardModifiers_, keysDown_, mouseButtonsDown_, povStates_, and sliderStates_.

Referenced by _reload(), and initialise().

void orxonox::InputManager::_completeCalibration | ( |  | ) | `[private]`

References _evaluateCalibration(), Calibrating, orxonox::ConfigFileManager::getInstance(), internalState_, orxonox::ConfigFileType::JoyStickCalibration, joyStickIDs_, joyStickMaxValues_, joyStickMiddleValues_, joyStickMinValues_, joySticks_, joySticksSize_, requestLeaveState(), orxonox::ConfigFileManager::setValue(), and sliderAxes.

Referenced by initialise().

bool orxonox::InputManager::_configureInputState | ( | InputState * | state,
|  | const std::string & | name,
|  | bool | bAlwaysGetsInput,
|  | bool | bTransparent,
|  | int | priority |
| ) |  |  | `[private]`

Adds a new key handler.

Parameters:

  | handler | Pointer to the handler object.
  | name | Unique name of the handler.
  | priority | Determines which InputState gets the input. Higher is better. Use 0 to handle it implicitely by the order of activation. Otherwise numbers larger than maxStateStackSize_s have to be used!

Returns:
  True if added, false if name or priority already existed.

References orxonox::InputState::bAlwaysGetsInput_, orxonox::InputState::bTransparent_, COUT, orxonox::InputStatePriority::Empty, orxonox::InputStatePriority::HighPriority, inputStatesByName_, numberOfJoySticks(), orxonox::InputState::setName(), orxonox::InputState::setNumOfJoySticks(), and orxonox::InputState::setPriority().

Referenced by createInputState().

void orxonox::InputManager::_configureJoySticks | ( |  | ) | `[private]`

Sets the size of all the different lists that are dependent on the number of joy stick devices created and loads the joy stick calibration.

Remarks:
  No matter whether there are a mouse and/or keyboard, they will always occupy 2 places in the device number dependent lists.

References _evaluateCalibration(), activeStatesTriggered_, devicesNum_, inputStatesByName_, joyStickButtonsDown_, joyStickCalibrations_, joyStickIDs_, joyStickMaxValues_, joyStickMiddleValues_, joyStickMinValues_, joySticks_, joySticksSize_, orxonox::loadCalibration(), orxonox::multi_cast(), OIS::OIS_Axis, OIS::OIS_Button, OIS::OIS_POV, OIS::OIS_Slider, OIS::OIS_Vector3, povStates_, sliderAxes, and sliderStates_.

Referenced by initialise().

void orxonox::InputManager::_destroyJoySticks | ( |  | ) | `[private]`

Destroys all the joy sticks and resizes the lists to 0.

References CCOUT, OIS::InputManager::destroyInputObject(), inputSystem_, joySticks_, and joySticksSize_.

Referenced by _reload(), and ~InputManager().

void orxonox::InputManager::_destroyKeyboard | ( |  | ) | `[private]`

Destroys the keyboard and sets it to 0.

References CCOUT, OIS::InputManager::destroyInputObject(), inputSystem_, and keyboard_.

Referenced by _reload(), and ~InputManager().

void orxonox::InputManager::_destroyMouse | ( |  | ) | `[private]`

Destroys the mouse and sets it to 0.

References CCOUT, OIS::InputManager::destroyInputObject(), inputSystem_, and mouse_.

Referenced by _reload(), and ~InputManager().

void orxonox::InputManager::_destroyState | ( | InputState * | state | ) | `[private]`

Removes and destroys an InputState.

Returns:
  True if state was removed immediately, false if postponed.

References _updateActiveStates(), activeStates_, orxonox::InputState::getName(), orxonox::InputState::getPriority(), inputStatesByName_, internalState_, and Ticking.

Referenced by requestDestroyState(), update(), and ~InputManager().

void orxonox::InputManager::_evaluateCalibration | ( |  | ) | `[private]`

References joyStickCalibrations_, joyStickMaxValues_, joyStickMiddleValues_, joyStickMinValues_, and joySticksSize_.

Referenced by _completeCalibration(), and _configureJoySticks().

void orxonox::InputManager::_fireAxis | ( | unsigned int | iJoyStick,
|  | int | axis,
|  | int | value |
| ) |  |  | `[private]`

Calls the states for a particular axis with our enumeration. Used by OIS sliders and OIS axes.

References activeStatesTriggered_, Calibrating, internalState_, joyStickCalibrations_, joyStickMaxValues_, and joyStickMinValues_.

Referenced by axisMoved(), and sliderMoved().

unsigned int orxonox::InputManager::_getJoystick | ( | const OIS::JoyStickEvent & | arg | ) | `[inline, private]`

Returns the joy stick ID (orxonox) according to a OIS::JoyStickEvent.

References OIS::EventArg::device, joySticks_, and joySticksSize_.

Referenced by axisMoved(), buttonPressed(), buttonReleased(), povMoved(), and sliderMoved().

void orxonox::InputManager::_initialiseJoySticks | ( |  | ) | `[private]`

Creates all joy sticks and sets the event handler.

Returns:
  False joy stick stay uninitialised, true otherwise.

References CCOUT, OIS::InputManager::createInputObject(), OIS::Exception::eText, OIS::Object::getID(), OIS::InputManager::getNumberOfDevices(), inputSystem_, joySticks_, joySticksSize_, OIS::OISJoyStick, ORX_DEBUG, ORX_WARNING, and OIS::JoyStick::setEventCallback().

Referenced by initialise().

void orxonox::InputManager::_initialiseKeyboard | ( |  | ) | `[private]`

Creates a keyboard and sets the event handler.

Returns:
  False if keyboard stays uninitialised, true otherwise.

References CCOUT, OIS::InputManager::createInputObject(), OIS::InputManager::getNumberOfDevices(), inputSystem_, keyboard_, OIS::OISKeyboard, ORX_DEBUG, OIS::Keyboard::setEventCallback(), and ThrowException.

Referenced by initialise().

void orxonox::InputManager::_initialiseMouse | ( |  | ) | `[private]`

Creates a mouse and sets the event handler.

Returns:
  False if mouse stays uninitialised, true otherwise.

References CCOUT, OIS::InputManager::createInputObject(), OIS::Exception::eText, OIS::InputManager::getNumberOfDevices(), inputSystem_, mouse_, OIS::OISMouse, ORX_DEBUG, ORX_WARNING, and OIS::Mouse::setEventCallback().

Referenced by initialise().

void orxonox::InputManager::_loadCalibration | ( |  | ) | `[private]`

void orxonox::InputManager::_reload | ( | bool | joyStickSupport | ) | `[private]`

Internal reload method. Destroys the OIS devices and loads them again.

References _clearBuffers(), _destroyJoySticks(), _destroyKeyboard(), _destroyMouse(), CCOUT, OIS::InputManager::destroyInputSystem(), OIS::Mouse::getMouseState(), initialise(), inputSystem_, internalState_, mouse_, OISReady, OIS::Exception::what(), and windowHnd_.

Referenced by reloadInputSystem(), and update().

void orxonox::InputManager::_startCalibration | ( |  | ) | `[private]`

References Calibrating, getInstance(), internalState_, joyStickMaxValues_, joyStickMiddleValues_, joyStickMinValues_, joySticksSize_, and requestEnterState().

Referenced by calibrate().

void orxonox::InputManager::_updateActiveStates | ( |  | ) | `[private]`

Updates the currently active states (according to activeStates_) for each device. Also, a list of all active states (no duplicates!) is compiled for the general update().

References activeStates_, activeStatesTicked_, activeStatesTriggered_, devicesNum_, and mouseButtonsDown_.

Referenced by _destroyState(), initialise(), and update().

bool orxonox::InputManager::axisMoved | ( | const OIS::JoyStickEvent & | arg,
|  | int | axis |
| ) |  |  | `[private, virtual]`

Remarks:
  Joystick axis moved event

Implements OIS::JoyStickListener.

References _fireAxis(), _getJoystick(), sliderAxes, and OIS::JoyStickEvent::state.

bool orxonox::InputManager::buttonPressed | ( | const OIS::JoyStickEvent & | arg,
|  | int | button |
| ) |  |  | `[private, virtual]`

Remarks:
  Joystick button down event

Implements OIS::JoyStickListener.

References _getJoystick(), activeStatesTriggered_, and joyStickButtonsDown_.

Referenced by povMoved().

bool orxonox::InputManager::buttonReleased | ( | const OIS::JoyStickEvent & | arg,
|  | int | button |
| ) |  |  | `[private, virtual]`

Remarks:
  Joystick button up event

Implements OIS::JoyStickListener.

References _getJoystick(), activeStatesTriggered_, and joyStickButtonsDown_.

Referenced by povMoved().

void orxonox::InputManager::calibrate | ( |  | ) | `[static]`

Starts joy stick calibration.

References _startCalibration(), COUT, and getInstance().

void orxonox::InputManager::clearBuffers | ( |  | ) |

Clears all buffers that store what keys/buttons are being pressed at the moment.

References joyStickButtonsDown_, joySticksSize_, keysDown_, and mouseButtonsDown_.

Referenced by orxonox::GSGraphics::windowFocusChanged().

template<class T>

T * orxonox::InputManager::createInputState | ( | const std::string & | name,
|  | bool | bAlwaysGetsInput = `false`,
|  | bool | bTransparent = `false`,
|  | InputStatePriority | priority = `InputStatePriority::Dynamic` |
| ) |  |  | `[inline]`

Creates a new InputState by type, name and priority.

You will have to use this method because the c'tors and d'tors are private.

Remarks:
  The InputManager will take care of the state completely. That also means it gets deleted when the InputManager is destroyed!

Parameters:

  | name | Name of the InputState when referenced as string
  | priority | Priority matters when multiple states are active. You can specify any number, but 1 - 99 is preferred (99 means high).

References _configureInputState(), and orxonox::KeyCode::T.

Referenced by orxonox::GSMainMenu::activate(), orxonox::GSLevel::activate(), orxonox::GSGraphics::activate(), and orxonox::InGameConsole::initialise().

InputState * orxonox::InputManager::getCurrentState | ( |  | ) |

Returns the current input state (there might be others active too!).

Returns:
  The current highest prioritised active input state.

References activeStates_.

static InputManager& orxonox::InputManager::getInstance | ( |  | ) | `[inline, static]`

Referenced by _startCalibration(), orxonox::InGameConsole::activate(), orxonox::GSMainMenu::activate(), orxonox::GSLevel::activate(), orxonox::GSGraphics::activate(), calibrate(), orxonox::GUIOverlay::changedVisibility(), orxonox::InGameConsole::deactivate(), orxonox::GSMainMenu::deactivate(), orxonox::GSLevel::deactivate(), orxonox::GSGraphics::deactivate(), orxonox::InGameConsole::initialise(), orxonox::KeyBinder::KeyBinder(), orxonox::GSLevel::keybindInternal(), reload(), orxonox::GSLevel::showIngameGUI(), orxonox::PickupInventory::toggleInventory(), and orxonox::InGameConsole::~InGameConsole().

static InputManager* orxonox::InputManager::getInstancePtr | ( |  | ) | `[inline, static]`

InputState * orxonox::InputManager::getState | ( | const std::string & | name | ) |

Returns the pointer to the requested InputState.

Parameters:

  | name | Unique name of the state.

Returns:
  Pointer to the instance, 0 if name was not found.

References inputStatesByName_.

void orxonox::InputManager::initialise | ( | size_t | windowHnd,
|  | int | windowWidth,
|  | int | windowHeight,
|  | bool | joyStickSupport = `true` |
| ) |  |  |

Creates the OIS::InputMananger, the keyboard, the mouse and the joysticks and assigns the key bindings.

Parameters:

  | windowHnd | The window handle of the render window
  | windowWidth | The width of the render window
  | windowHeight | The height of the render window
  | joyStickSupport | Whether or not to load the joy sticks as well

References _clearBuffers(), _completeCalibration(), _configureJoySticks(), _initialiseJoySticks(), _initialiseKeyboard(), _initialiseMouse(), _updateActiveStates(), activeStates_, orxonox::InputStatePriority::Calibrator, calibratorCallbackBuffer_, CCOUT, OIS::InputManager::createInputSystem(), OIS::InputManager::destroyInputSystem(), orxonox::InputStatePriority::Detector, Loki::ScopeGuardImplBase::Dismiss(), orxonox::InputStatePriority::Empty, EMPTY_HANDLER, orxonox::InputState::getPriority(), orxonox::CommandLine::getValue(), inputSystem_, InternalsReady, internalState_, keyDetector_, Loki::MakeGuard(), mouse_, OISReady, ORX_DEBUG, orxonox::InputBuffer::registerListener(), orxonox::SimpleInputState::setHandler(), orxonox::SimpleInputState::setKeyHandler(), setWindowExtents(), stateEmpty_, ThrowException, OIS::Exception::what(), and windowHnd_.

Referenced by _reload(), and orxonox::GSGraphics::activate().

bool orxonox::InputManager::keyPressed | ( | const OIS::KeyEvent & | e | ) | `[private, virtual]`

Event handler for the keyPressed Event.

Parameters:

  | e | Event information

Implements OIS::KeyListener.

References activeStatesTriggered_, orxonox::KeyboardModifier::Alt, orxonox::KeyboardModifier::Ctrl, OIS::KC_LCONTROL, OIS::KC_LMENU, OIS::KC_LSHIFT, OIS::KC_RCONTROL, OIS::KC_RMENU, OIS::KC_RSHIFT, OIS::KeyEvent::key, orxonox::InputDevice::Keyboard, keyboardModifiers_, keysDown_, and orxonox::KeyboardModifier::Shift.

bool orxonox::InputManager::keyReleased | ( | const OIS::KeyEvent & | e | ) | `[private, virtual]`

Event handler for the keyReleased Event.

Parameters:

  | e | Event information

Implements OIS::KeyListener.

References activeStatesTriggered_, orxonox::KeyboardModifier::Alt, orxonox::KeyboardModifier::Ctrl, OIS::KC_LCONTROL, OIS::KC_LMENU, OIS::KC_LSHIFT, OIS::KC_RCONTROL, OIS::KC_RMENU, OIS::KC_RSHIFT, OIS::KeyEvent::key, orxonox::InputDevice::Keyboard, keyboardModifiers_, keysDown_, and orxonox::KeyboardModifier::Shift.

bool orxonox::InputManager::mouseMoved | ( | const OIS::MouseEvent & | e | ) | `[private, virtual]`

Event handler for the mouseMoved Event.

Parameters:

  | e | Event information

Implements OIS::MouseListener.

References activeStatesTriggered_, orxonox::InputDevice::Mouse, and OIS::MouseEvent::state.

bool orxonox::InputManager::mousePressed | ( | const OIS::MouseEvent & | e,
|  | OIS::MouseButtonID | id |
| ) |  |  | `[private, virtual]`

Event handler for the mousePressed Event.

Parameters:

  | e | Event information
  | id | The ID of the mouse button

Implements OIS::MouseListener.

References activeStatesTriggered_, orxonox::InputDevice::Mouse, and mouseButtonsDown_.

bool orxonox::InputManager::mouseReleased | ( | const OIS::MouseEvent & | e,
|  | OIS::MouseButtonID | id |
| ) |  |  | `[private, virtual]`

Event handler for the mouseReleased Event.

Parameters:

  | e | Event information
  | id | The ID of the mouse button

Implements OIS::MouseListener.

References activeStatesTriggered_, orxonox::InputDevice::Mouse, and mouseButtonsDown_.

unsigned int orxonox::InputManager::numberOfJoySticks | ( |  | ) | `[inline]`

Referenced by _configureInputState(), and orxonox::KeyBinder::KeyBinder().

unsigned int orxonox::InputManager::numberOfKeyboards | ( |  | ) | `[inline]`

unsigned int orxonox::InputManager::numberOfMice | ( |  | ) | `[inline]`

bool orxonox::InputManager::povMoved | ( | const OIS::JoyStickEvent & | arg,
|  | int | index |
| ) |  |  | `[private, virtual]`

Joystick Event, and povID.

Reimplemented from OIS::JoyStickListener.

References _getJoystick(), buttonPressed(), buttonReleased(), OIS::Pov::East, OIS::Pov::North, povStates_, OIS::Pov::South, OIS::JoyStickEvent::state, and OIS::Pov::West.

void orxonox::InputManager::reload | ( | bool | joyStickSupport = `true` | ) | `[static]`

Reloads the input system.

References getInstance(), and reloadInputSystem().

void orxonox::InputManager::reloadInputSystem | ( | bool | joyStickSupport = `true` | ) |

Public interface. Only reloads immediately if the call stack doesn't include the update() method.

Parameters:

  | joyStickSupport | Whether or not to initialise joy sticks as well.

References _reload(), CCOUT, internalState_, JoyStickSupport, OISReady, ReloadRequest, Ticking, and Uninitialised.

Referenced by reload().

bool orxonox::InputManager::requestDestroyState | ( | const std::string & | name | ) |

Removes and destroys an input state internally.

Parameters:

  | name | Name of the handler.

Returns:
  True if removal was successful, false if name was not found.

Remarks:
  You can't remove the internal states "empty", "calibrator" and "detector". The removal process is being postponed if InputManager::update() is currently running.

References _destroyState(), activeStates_, COUT, inputStatesByName_, internalState_, stateDestroyRequests_, stateLeaveRequests_, and Ticking.

Referenced by orxonox::GSMainMenu::deactivate(), orxonox::GSLevel::deactivate(), orxonox::GSGraphics::deactivate(), orxonox::InGameConsole::~InGameConsole(), and ~InputManager().

bool orxonox::InputManager::requestEnterState | ( | const std::string & | name | ) |

Activates a specific input state. It might not be really activated if the priority is too low!

Parameters:

  | name | Unique name of the state.

Returns:
  False if name was not found, true otherwise.

References activeStates_, inputStatesByName_, stateDestroyRequests_, and stateEnterRequests_.

Referenced by _startCalibration(), orxonox::InGameConsole::activate(), orxonox::GSMainMenu::activate(), orxonox::GSLevel::activate(), orxonox::GSGraphics::activate(), orxonox::GUIOverlay::changedVisibility(), orxonox::GSLevel::keybindInternal(), orxonox::GSLevel::showIngameGUI(), and orxonox::PickupInventory::toggleInventory().

bool orxonox::InputManager::requestLeaveState | ( | const std::string & | name | ) |

Deactivates a specific input state.

Parameters:

  | name | Unique name of the state.

Returns:
  False if name was not found, true otherwise.

References activeStates_, COUT, inputStatesByName_, and stateLeaveRequests_.

Referenced by _completeCalibration(), orxonox::GUIOverlay::changedVisibility(), orxonox::InGameConsole::deactivate(), orxonox::GSMainMenu::deactivate(), orxonox::GSLevel::deactivate(), orxonox::GSLevel::keybindInternal(), orxonox::GSLevel::showIngameGUI(), and orxonox::PickupInventory::toggleInventory().

void orxonox::InputManager::setConfigValues | ( |  | ) | `[private]`

Sets the configurable values.

Reimplemented from orxonox::OrxonoxClass.

References _calibrationFileCallback(), calibrationFilename_, and SetConfigValue.

Referenced by InputManager().

void orxonox::InputManager::setKeyDetectorCallback | ( | const std::string & | command | ) |

Sets the the name of the command used by the KeyDetector as callback.

Parameters:

  | command | Command name as string

References keyDetector_, and orxonox::KeyDetector::setCallbackCommand().

Referenced by orxonox::GSLevel::activate().

void orxonox::InputManager::setWindowExtents | ( | const int | width,
|  | const int | height |
| ) |  |  |

Adjusts the mouse window metrics. This method has to be called every time the size of the window changes.

Parameters:

  | width | The new width of the render window
  |  | The new height of the render window

References OIS::Mouse::getMouseState(), and mouse_.

Referenced by initialise(), and orxonox::GSGraphics::windowResized().

bool orxonox::InputManager::sliderMoved | ( | const OIS::JoyStickEvent & | ,
|  | int | index |
| ) |  |  | `[private, virtual]`

Joystick Event, and sliderID.

Reimplemented from OIS::JoyStickListener.

References _fireAxis(), _getJoystick(), sliderStates_, and OIS::JoyStickEvent::state.

void orxonox::InputManager::update | ( | const Clock & | time | ) |

Updates the states and the InputState situation.

Parameters:

  | time | Clock holding the current time.

References _destroyState(), _reload(), _updateActiveStates(), activeStates_, activeStatesTicked_, activeStatesTriggered_, Calibrating, OIS::Object::capture(), devicesNum_, orxonox::Clock::getDeltaTime(), orxonox::InputStatePriority::HighPriority, inputStatesByName_, internalState_, orxonox::InputDevice::JoyStick0, joyStickButtonsDown_, joySticks_, joySticksSize_, JoyStickSupport, orxonox::InputDevice::Keyboard, keyboard_, keyboardModifiers_, keysDown_, orxonox::InputDevice::Mouse, mouse_, mouseButtonsDown_, ReloadRequest, stateDestroyRequests_, stateEnterRequests_, stateLeaveRequests_, Ticking, and Uninitialised.

Referenced by orxonox::GSGraphics::update().

bool orxonox::InputManager::vector3Moved | ( | const OIS::JoyStickEvent & | arg,
|  | int | index |
| ) |  |  | `[inline, private, virtual]`

Joystick Event, and Vector3ID.

Reimplemented from OIS::JoyStickListener.

## Friends And Related Function Documentation

friend class ClassIdentifier< InputManager >`[friend]`

## Member Data Documentation

std::map<int, InputState*> orxonox::InputManager::activeStates_`[private]`

Referenced by _destroyState(), _updateActiveStates(), getCurrentState(), initialise(), requestDestroyState(), requestEnterState(), requestLeaveState(), update(), and ~InputManager().

std::vector<InputState*> orxonox::InputManager::activeStatesTicked_`[private]`

Referenced by _updateActiveStates(), and update().

std::vector<std::vector<InputState*> > orxonox::InputManager::activeStatesTriggered_`[private]`

Referenced by _configureJoySticks(), _fireAxis(), _updateActiveStates(), buttonPressed(), buttonReleased(), keyPressed(), keyReleased(), mouseMoved(), mousePressed(), mouseReleased(), and update().

std::vector<ConfigValueContainer*> orxonox::InputManager::calibrationConfigValueContainers_`[private]`

std::string orxonox::InputManager::calibrationFilename_`[private]`

Joy stick calibration ini filename.

Referenced by _calibrationFileCallback(), and setConfigValues().

InputBuffer* orxonox::InputManager::calibratorCallbackBuffer_`[private]`

Referenced by initialise(), and ~InputManager().

unsigned int orxonox::InputManager::devicesNum_`[private]`

Referenced by _configureJoySticks(), _updateActiveStates(), and update().

EmptyHandler orxonox::InputManager::EMPTY_HANDLER`[static]`

Referenced by orxonox::GSMainMenu::activate(), orxonox::InGameConsole::bHidesAllInputChanged(), and initialise().

std::map<std::string, InputState*> orxonox::InputManager::inputStatesByName_`[private]`

Referenced by _configureInputState(), _configureJoySticks(), _destroyState(), getState(), requestDestroyState(), requestEnterState(), requestLeaveState(), update(), and ~InputManager().

OIS::InputManager* orxonox::InputManager::inputSystem_`[private]`

OIS input manager.

Referenced by _destroyJoySticks(), _destroyKeyboard(), _destroyMouse(), _initialiseJoySticks(), _initialiseKeyboard(), _initialiseMouse(), _reload(), initialise(), and ~InputManager().

InputManagerState orxonox::InputManager::internalState_`[private]`

Current internal state.

Referenced by _completeCalibration(), _destroyState(), _fireAxis(), _reload(), _startCalibration(), initialise(), reloadInputSystem(), requestDestroyState(), update(), and ~InputManager().

std::vector<std::vector<JoyStickButtonCode::ByEnum> > orxonox::InputManager::joyStickButtonsDown_`[private]`

Referenced by _clearBuffers(), _configureJoySticks(), buttonPressed(), buttonReleased(), clearBuffers(), and update().

std::vector<JoyStickCalibration> orxonox::InputManager::joyStickCalibrations_`[private]`

Referenced by _configureJoySticks(), _evaluateCalibration(), and _fireAxis().

std::vector<std::string> orxonox::InputManager::joyStickIDs_`[private]`

Execution unique identification strings for the joy sticks.

Referenced by _completeCalibration(), and _configureJoySticks().

std::vector<std::vector<int> > orxonox::InputManager::joyStickMaxValues_`[private]`

Referenced by _completeCalibration(), _configureJoySticks(), _evaluateCalibration(), _fireAxis(), and _startCalibration().

std::vector<std::vector<int> > orxonox::InputManager::joyStickMiddleValues_`[private]`

Referenced by _completeCalibration(), _configureJoySticks(), _evaluateCalibration(), and _startCalibration().

std::vector<std::vector<int> > orxonox::InputManager::joyStickMinValues_`[private]`

Referenced by _completeCalibration(), _configureJoySticks(), _evaluateCalibration(), _fireAxis(), and _startCalibration().

std::vector<OIS::JoyStick*> orxonox::InputManager::joySticks_`[private]`

OIS joy sticks.

Referenced by _completeCalibration(), _configureJoySticks(), _destroyJoySticks(), _getJoystick(), _initialiseJoySticks(), and update().

unsigned int orxonox::InputManager::joySticksSize_`[private]`

Referenced by _clearBuffers(), _completeCalibration(), _configureJoySticks(), _destroyJoySticks(), _evaluateCalibration(), _getJoystick(), _initialiseJoySticks(), _startCalibration(), clearBuffers(), and update().

OIS::Keyboard* orxonox::InputManager::keyboard_`[private]`

OIS mouse.

Referenced by _destroyKeyboard(), _initialiseKeyboard(), and update().

unsigned int orxonox::InputManager::keyboardModifiers_`[private]`

Bit mask representing keyboard modifiers.

Referenced by _clearBuffers(), keyPressed(), keyReleased(), and update().

KeyDetector* orxonox::InputManager::keyDetector_`[private]`

KeyDetector instance.

Referenced by initialise(), setKeyDetectorCallback(), and ~InputManager().

std::vector<Key> orxonox::InputManager::keysDown_`[private]`

Referenced by _clearBuffers(), clearBuffers(), keyPressed(), keyReleased(), and update().

OIS::Mouse* orxonox::InputManager::mouse_`[private]`

OIS keyboard.

Referenced by _destroyMouse(), _initialiseMouse(), _reload(), initialise(), setWindowExtents(), and update().

std::vector<MouseButtonCode::ByEnum> orxonox::InputManager::mouseButtonsDown_`[private]`

Referenced by _clearBuffers(), _updateActiveStates(), clearBuffers(), mousePressed(), mouseReleased(), and update().

std::vector<POVStates> orxonox::InputManager::povStates_`[private]`

Keeps track of the joy stick POV states.

Referenced by _clearBuffers(), _configureJoySticks(), and povMoved().

InputManager * orxonox::InputManager::singletonRef_s = 0`[static, private]`

Referenced by InputManager(), and ~InputManager().

const unsigned int orxonox::InputManager::sliderAxes = 8`[static]`

Referenced by _completeCalibration(), _configureJoySticks(), and axisMoved().

std::vector<SliderStates> orxonox::InputManager::sliderStates_`[private]`

Keeps track of the possibly two slider axes.

Referenced by _clearBuffers(), _configureJoySticks(), and sliderMoved().

std::set<InputState*> orxonox::InputManager::stateDestroyRequests_`[private]`

Request to destroy a state.

Referenced by requestDestroyState(), requestEnterState(), and update().

SimpleInputState* orxonox::InputManager::stateEmpty_`[private]`

Referenced by initialise(), and ~InputManager().

std::set<InputState*> orxonox::InputManager::stateEnterRequests_`[private]`

Request to enter a new state.

Referenced by requestEnterState(), and update().

std::set<InputState*> orxonox::InputManager::stateLeaveRequests_`[private]`

Request to leave a running state.

Referenced by requestDestroyState(), requestLeaveState(), and update().

size_t orxonox::InputManager::windowHnd_`[private]`

Render window handle.

Referenced by _reload(), and initialise().

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

- src/core/input/InputManager.h
- src/core/input/InputManager.cc