orxonox::KeyBinder Class Reference

Handles mouse, keyboard and joy stick input while in the actual game mode. Manages the key bindings. More...

#include <src/core/input/KeyBinder.h>

Inheritance diagram for orxonox::KeyBinder:

orxonox::KeyHandler orxonox::MouseHandler orxonox::JoyStickHandler orxonox::JoyStickDeviceNumberListener orxonox::InputHandler orxonox::InputHandler orxonox::InputHandler orxonox::OrxonoxClass orxonox::KeyDetector

List of all members.

Public Member Functions

void clearBindings ()
 Overwrites all bindings with "".
 KeyBinder ()
 Constructor that does as little as necessary.
void loadBindings (const std::string &filename)
 Loads the key and button bindings.
void resetJoyStickAxes ()
bool setBinding (const std::string &binding, const std::string &name, bool bTemporary=false)
void setConfigValues ()
 Loader for the key bindings, managed by config values.
virtual ~KeyBinder ()
 Destructor.

Protected Member Functions

void buttonThresholdChanged ()
void compilePointerLists ()
void initialiseJoyStickBindings ()
void joyStickAxisMoved (unsigned int joyStickID, unsigned int axis, float value)
void joyStickButtonHeld (unsigned int joyStickID, JoyStickButtonCode::ByEnum id)
void joyStickButtonPressed (unsigned int joyStickID, JoyStickButtonCode::ByEnum id)
void joyStickButtonReleased (unsigned int joyStickID, JoyStickButtonCode::ByEnum id)
virtual void JoyStickDeviceNumberChanged (unsigned int value)
void keyHeld (const KeyEvent &evt)
void keyPressed (const KeyEvent &evt)
void keyReleased (const KeyEvent &evt)
void mouseButtonHeld (MouseButtonCode::ByEnum id)
void mouseButtonPressed (MouseButtonCode::ByEnum id)
void mouseButtonReleased (MouseButtonCode::ByEnum id)
void mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
 Event handler for the mouseMoved Event.
void mouseScrolled (int abs, int rel)
 Event handler for the mouseScrolled Event.
void tickHalfAxis (HalfAxis &halfAxis)
void updateInput (float dt)
void updateJoyStick (float dt, unsigned int joyStick)
void updateKey (float dt)
void updateMouse (float dt)

Protected Attributes

std::map< std::string, Button * > allButtons_
 Pointer map with all Buttons, including half axes.
std::vector< HalfAxis * > allHalfAxes_
 Pointer list with all half axes.
ConfigFileType configFile_
 Config file used. ConfigFileType::NoType in case of KeyDetector. Also indicates whether we've already loaded.
float deriveTime_
std::vector< JoyStickAxisVectorjoyStickAxes_
 Actual key bindings for joy stick axes (and sliders).
std::vector< JoyStickButtonVectorjoyStickButtons_
 Actual key bindings for joy stick buttons.
Button keys_ [KeyCode::numberOfKeys]
 Actual key bindings for keys on the keyboard.
HalfAxis mouseAxes_ [MouseAxisCode::numberOfAxes *2]
 Actual key bindings for mouse axes.
Button mouseButtons_ [numberOfMouseButtons_]
 Actual key bindings for mouse buttons including the wheel(s).
int mousePosition_ [2]
 Keeps track of the absolute mouse value (incl. scroll wheel).
int mouseRelative_ [2]
 Used to derive mouse input if requested.
unsigned int numberOfJoySticks_
 Currently active joy sticks.
std::vector
< BufferedParamCommand * > 
paramCommandBuffer_
 Commands that have additional parameters (axes) are executed at the end of update() so that all values can be buffered for single execution.

Static Protected Attributes

static const unsigned int numberOfMouseButtons_ = MouseButtonCode::numberOfButtons + 4
 Number of mouse buttons in KeyBinder (+4).

Private Attributes

float analogThreshold_
 Threshold for analog triggers until which the state is 0.
bool bDeriveMouseInput_
 Derive mouse input for absolute values?
bool bFilterAnalogNoise_
 Whether to filter small value analog input.
float buttonThreshold_
 Threshold for analog triggers until which the button is not pressed.
float derivePeriod_
 Accuracy of the mouse input deriver. The higher the more precise, but laggier.
float mouseSensitivity_
 mouse sensitivity
float mouseSensitivityDerived_
 mouse sensitivity if mouse input is derived
int mouseWheelStepSize_
 Equals one step of the mousewheel.

Static Private Attributes

static const int mouseClippingSize_ = 1024

Classes

struct  JoyStickAxisVector
 Helper class to use something like std:vector<HalfAxis[48]>. More...
struct  JoyStickButtonVector
 Helper class to use something like std:vector<Button[64]>. More...


Detailed Description

Handles mouse, keyboard and joy stick input while in the actual game mode. Manages the key bindings.

Constructor & Destructor Documentation

orxonox::KeyBinder::KeyBinder (  ) 

orxonox::KeyBinder::~KeyBinder (  )  [virtual]

Destructor.

References clearBindings().


Member Function Documentation

void orxonox::KeyBinder::buttonThresholdChanged (  )  [protected]

void orxonox::KeyBinder::clearBindings (  ) 

Overwrites all bindings with "".

References allButtons_, and paramCommandBuffer_.

Referenced by loadBindings(), orxonox::KeyDetector::setCallbackCommand(), and ~KeyBinder().

void orxonox::KeyBinder::compilePointerLists (  )  [protected]

void orxonox::KeyBinder::initialiseJoyStickBindings (  )  [protected]

void orxonox::KeyBinder::joyStickAxisMoved ( unsigned int  joyStickID,
unsigned int  axis,
float  value 
) [protected, virtual]

Implements orxonox::JoyStickHandler.

References joyStickAxes_.

void orxonox::KeyBinder::joyStickButtonHeld ( unsigned int  joyStickID,
JoyStickButtonCode::ByEnum  id 
) [inline, protected, virtual]

void orxonox::KeyBinder::joyStickButtonPressed ( unsigned int  joyStickID,
JoyStickButtonCode::ByEnum  id 
) [inline, protected, virtual]

void orxonox::KeyBinder::joyStickButtonReleased ( unsigned int  joyStickID,
JoyStickButtonCode::ByEnum  id 
) [inline, protected, virtual]

void orxonox::KeyBinder::JoyStickDeviceNumberChanged ( unsigned int  value  )  [protected, virtual]

void orxonox::KeyBinder::keyHeld ( const KeyEvent evt  )  [inline, protected, virtual]

void orxonox::KeyBinder::keyPressed ( const KeyEvent evt  )  [inline, protected, virtual]

void orxonox::KeyBinder::keyReleased ( const KeyEvent evt  )  [inline, protected, virtual]

void orxonox::KeyBinder::loadBindings ( const std::string filename  ) 

void orxonox::KeyBinder::mouseButtonHeld ( MouseButtonCode::ByEnum  id  )  [inline, protected, virtual]

void orxonox::KeyBinder::mouseButtonPressed ( MouseButtonCode::ByEnum  id  )  [inline, protected, virtual]

void orxonox::KeyBinder::mouseButtonReleased ( MouseButtonCode::ByEnum  id  )  [inline, protected, virtual]

void orxonox::KeyBinder::mouseMoved ( IntVector2  abs_,
IntVector2  rel_,
IntVector2  clippingSize 
) [protected, virtual]

void orxonox::KeyBinder::mouseScrolled ( int  abs,
int  rel 
) [protected, virtual]

Event handler for the mouseScrolled Event.

Parameters:
e Mouse state information

Implements orxonox::MouseHandler.

References mouseButtons_, mouseWheelStepSize_, and orxonox::KeybindMode::OnPress.

void orxonox::KeyBinder::resetJoyStickAxes (  ) 

bool orxonox::KeyBinder::setBinding ( const std::string binding,
const std::string name,
bool  bTemporary = false 
)

References allButtons_, and COUT.

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

void orxonox::KeyBinder::setConfigValues (  ) 

void orxonox::KeyBinder::tickHalfAxis ( HalfAxis halfAxis  )  [protected]

void orxonox::KeyBinder::updateInput ( float  dt  )  [inline, protected, virtual]

void orxonox::KeyBinder::updateJoyStick ( float  dt,
unsigned int  joyStick 
) [protected, virtual]

void orxonox::KeyBinder::updateKey ( float  dt  )  [inline, protected, virtual]

Implements orxonox::KeyHandler.

void orxonox::KeyBinder::updateMouse ( float  dt  )  [protected, virtual]


Member Data Documentation

Pointer map with all Buttons, including half axes.

Referenced by clearBindings(), compilePointerLists(), loadBindings(), setBinding(), and orxonox::KeyDetector::setCallbackCommand().

std::vector<HalfAxis*> orxonox::KeyBinder::allHalfAxes_ [protected]

Pointer list with all half axes.

Referenced by buttonThresholdChanged(), and compilePointerLists().

Threshold for analog triggers until which the state is 0.

Referenced by setConfigValues(), and tickHalfAxis().

Derive mouse input for absolute values?

Referenced by mouseMoved(), setConfigValues(), and updateMouse().

Whether to filter small value analog input.

Referenced by setConfigValues(), and tickHalfAxis().

Threshold for analog triggers until which the button is not pressed.

Referenced by buttonThresholdChanged(), and setConfigValues().

Config file used. ConfigFileType::NoType in case of KeyDetector. Also indicates whether we've already loaded.

Referenced by JoyStickDeviceNumberChanged(), KeyBinder(), and loadBindings().

Accuracy of the mouse input deriver. The higher the more precise, but laggier.

Referenced by setConfigValues(), and updateMouse().

Referenced by updateMouse().

Actual key bindings for keys on the keyboard.

Referenced by compilePointerLists(), KeyBinder(), keyHeld(), keyPressed(), and keyReleased().

Actual key bindings for mouse axes.

Referenced by compilePointerLists(), KeyBinder(), mouseMoved(), updateInput(), and updateMouse().

Actual key bindings for mouse buttons including the wheel(s).

Referenced by compilePointerLists(), KeyBinder(), mouseButtonHeld(), mouseButtonPressed(), mouseButtonReleased(), and mouseScrolled().

const int orxonox::KeyBinder::mouseClippingSize_ = 1024 [static, private]

Referenced by mouseMoved().

Keeps track of the absolute mouse value (incl. scroll wheel).

Referenced by KeyBinder(), and mouseMoved().

Used to derive mouse input if requested.

Referenced by KeyBinder(), mouseMoved(), and updateMouse().

mouse sensitivity

Referenced by mouseMoved(), and setConfigValues().

mouse sensitivity if mouse input is derived

Referenced by setConfigValues(), and updateMouse().

Equals one step of the mousewheel.

Referenced by mouseScrolled(), and setConfigValues().

unsigned int orxonox::KeyBinder::numberOfJoySticks_ [protected]

Number of mouse buttons in KeyBinder (+4).

Referenced by compilePointerLists(), and KeyBinder().

Commands that have additional parameters (axes) are executed at the end of update() so that all values can be buffered for single execution.

Referenced by clearBindings(), initialiseJoyStickBindings(), KeyBinder(), and updateInput().


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

Generated on Tue Jul 28 16:22:40 2009 for Orxonox by  doxygen 1.5.6