Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
orxonox::KeyDetector Class Reference

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/input/KeyDetector.h>

Inheritance diagram for orxonox::KeyDetector:
orxonox::KeyBinder orxonox::Singleton< KeyDetector > orxonox::InputHandler orxonox::JoyStickQuantityListener orxonox::Listable orxonox::Identifiable

Public Member Functions

 KeyDetector ()
 
 ~KeyDetector ()
 
void setCallback (const FunctorPtr &function)
 
- Public Member Functions inherited from orxonox::KeyBinder
 KeyBinder (const std::string &filename)
 Constructor that does as little as necessary. More...
 
virtual ~KeyBinder ()
 Destructor. More...
 
void changeMode (ConsoleCommand *command, KeybindMode::Value mode)
 Changes the keybind mode of a given console command. More...
 
void clearBindings ()
 Overwrites all bindings with "". More...
 
std::string getBinding (const std::string &commandName)
 Return the first key name for a specific command. More...
 
std::string getBinding (const std::string &commandName, unsigned int index)
 Return the key name for a specific command at a given index. More...
 
std::string getBindingReadable (const std::string &commandName)
 Return the first key name for a specific command in a human readable form. More...
 
const std::string & getBindingsFilename ()
 
unsigned int getNumberOfBindings (const std::string &commandName)
 Get the number of different key bindings of a specific command. More...
 
void resetJoyStickAxes ()
 
void resetMouseAxes ()
 Sets the position of the mouse back to 0/0. More...
 
bool setBinding (const std::string &binding, const std::string &name, bool bTemporary=false)
 
void setConfigValues ()
 Loader for the key bindings, managed by config values. More...
 
- Public Member Functions inherited from orxonox::InputHandler
virtual ~InputHandler ()=default
 
template<class T >
void buttonEvent (unsigned int device, T button, ButtonEvent::TPress)
 
template<class T >
void buttonEvent (unsigned int device, T button, ButtonEvent::TRelease)
 
template<class T >
void buttonEvent (unsigned int device, T button, ButtonEvent::THold)
 
virtual void keyboardUpdated (float dt)
 
- Public Member Functions inherited from orxonox::Listable
 Listable ()
 Constructor: Allocates space in the element list. More...
 
 Listable (Context *context)
 Constructor: Allocates space in the element list and assigns the context. More...
 
virtual ~Listable ()
 Destructor: Removes the object from the object-lists. More...
 
ContextgetContext () const
 
void setContext (Context *context)
 Changes the context. More...
 
void unregisterObject ()
 Removes this object from the object-lists. More...
 
- Public Member Functions inherited from orxonox::Identifiable
 Identifiable ()
 Constructor: Sets the default values. More...
 
virtual ~Identifiable ()
 
ORX_FORCEINLINE voidgetDerivedPointer (unsigned int classID)
 Returns a valid pointer of any derived type that is registered in the class hierarchy. More...
 
template<class T >
ORX_FORCEINLINE T * getDerivedPointer (unsigned int classID)
 Version of getDerivedPointer with template. More...
 
template<class T >
ORX_FORCEINLINE const T * getDerivedPointer (unsigned int classID) const
 Const version of getDerivedPointer with template. More...
 
IdentifiergetIdentifier () const
 Returns the Identifier of the object. More...
 
bool isA (const Identifier *identifier)
 Returns true if the object's class is of the given type or a derivative. More...
 
template<class B >
bool isA (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is of the given type or a derivative. More...
 
bool isA (const Identifiable *object)
 Returns true if the object's class is of the given type or a derivative. More...
 
bool isChildOf (const Identifier *identifier)
 Returns true if the object's class is a child of the given type. More...
 
template<class B >
bool isChildOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a child of the given type. More...
 
bool isChildOf (const Identifiable *object)
 Returns true if the object's class is a child of the given type. More...
 
bool isDirectChildOf (const Identifier *identifier)
 Returns true if the object's class is a direct child of the given type. More...
 
template<class B >
bool isDirectChildOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isDirectChildOf (const Identifiable *object)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isDirectParentOf (const Identifier *identifier)
 Returns true if the object's class is a direct parent of the given type. More...
 
template<class B >
bool isDirectParentOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a direct parent of the given type. More...
 
bool isDirectParentOf (const Identifiable *object)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isExactlyA (const Identifier *identifier)
 Returns true if the object's class is exactly of the given type. More...
 
template<class B >
bool isExactlyA (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is exactly of the given type. More...
 
bool isExactlyA (const Identifiable *object)
 Returns true if the object's class is exactly of the given type. More...
 
bool isParentOf (const Identifier *identifier)
 Returns true if the object's class is a parent of the given type. More...
 
template<class B >
bool isParentOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a parent of the given type. More...
 
bool isParentOf (const Identifiable *object)
 Returns true if the object's class is a parent of the given type. More...
 

Private Member Functions

 KeyDetector (const KeyDetector &)=delete
 
void assignCommands ()
 
void callback (const std::string &name)
 
virtual void JoyStickQuantityChanged (const std::vector< JoyStick * > &joyStickList) override
 Called whenever joy sticks get added/removed. More...
 
KeyDetectoroperator= (const KeyDetector &)=delete
 

Private Attributes

FunctorPtr callbackFunction_
 
InputStateinputState_
 

Static Private Attributes

static KeyDetectorsingletonPtr_s
 

Friends

class Singleton< KeyDetector >
 

Additional Inherited Members

- Static Public Member Functions inherited from orxonox::Singleton< KeyDetector >
static bool exists ()
 Tells whether the singleton has been created. More...
 
static KeyDetectorgetInstance ()
 Returns a reference to the singleton instance. More...
 
- Static Public Attributes inherited from orxonox::InputHandler
static InputHandler EMPTY
 Use this input handler if you want to occupy a device in an input state. More...
 
- Protected Member Functions inherited from orxonox::KeyBinder
virtual void allDevicesUpdated (float dt) override
 
virtual void axisMoved (unsigned int device, unsigned int axis, float value) override
 
virtual void buttonHeld (const KeyEvent &evt) override
 
virtual void buttonHeld (MouseButtonCode::ByEnum button) override
 
virtual void buttonHeld (unsigned int device, JoyStickButtonCode::ByEnum button) override
 
virtual void buttonPressed (const KeyEvent &evt) override
 
virtual void buttonPressed (MouseButtonCode::ByEnum button) override
 
virtual void buttonPressed (unsigned int device, JoyStickButtonCode::ByEnum button) override
 
virtual void buttonReleased (const KeyEvent &evt) override
 
virtual void buttonReleased (MouseButtonCode::ByEnum button) override
 
virtual void buttonReleased (unsigned int device, JoyStickButtonCode::ByEnum button) override
 
void buttonThresholdChanged ()
 
void compilePointerLists ()
 
void initialiseJoyStickBindings ()
 
virtual void joyStickUpdated (unsigned int joyStick, float dt) override
 
void loadBindings ()
 Loads the key and button bindings. More...
 
virtual void mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) override
 Event handler for the mouseMoved Event. More...
 
virtual void mouseScrolled (int abs, int rel) override
 Event handler for the mouseScrolled Event. More...
 
virtual void mouseUpdated (float dt) override
 
void tickHalfAxis (HalfAxis &halfAxis)
 
- Protected Member Functions inherited from orxonox::JoyStickQuantityListener
 JoyStickQuantityListener ()
 
virtual ~JoyStickQuantityListener ()=default
 
const std::vector< JoyStick * > & getJoyStickList () const
 Returns a list with all JoySticks currently loaded. More...
 
- Protected Member Functions inherited from orxonox::Singleton< KeyDetector >
 Singleton ()
 Constructor sets the singleton instance pointer. More...
 
virtual ~Singleton ()
 Destructor resets the singleton instance pointer. More...
 
- Protected Attributes inherited from orxonox::KeyBinder
std::map< std::string, Button * > allButtons_
 Pointer map with all Buttons, including half axes. More...
 
std::map< std::string, std::vector< std::string > > allCommands_
 Maps input commands to all Button names, including half axes. More...
 
std::vector< HalfAxis * > allHalfAxes_
 Pointer list with all half axes. More...
 
ConfigFileconfigFile_
 Config file used. nullptr in case of KeyDetector. Also indicates whether we've already loaded. More...
 
float deriveTime_
 
ConfigFilefallbackConfigFile_
 Config file from the data directory that only serves as fallback. More...
 
const std::string filename_
 Name of the file used in this KeyBinder (constant!) More...
 
std::vector< std::shared_ptr< JoyStickAxisVector > > joyStickAxes_
 Actual key bindings for joy stick axes (and sliders) More...
 
std::vector< std::shared_ptr< JoyStickButtonVector > > joyStickButtons_
 Actual key bindings for joy stick buttons. More...
 
std::vector< JoyStick * > joySticks_
 Currently active joy sticks. More...
 
Button keys_ [KeyCode::numberOfKeys]
 Actual key bindings for keys on the keyboard. More...
 
HalfAxis mouseAxes_ [MouseAxisCode::numberOfAxes *2]
 Actual key bindings for mouse axes. More...
 
Button mouseButtons_ [numberOfMouseButtons_]
 Actual key bindings for mouse buttons including the wheel(s) More...
 
float mousePosition_ [2]
 Keeps track of the absolute mouse value. More...
 
int mouseRelative_ [2]
 Used to derive mouse input if requested. More...
 
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. More...
 
- Static Protected Attributes inherited from orxonox::KeyBinder
static const unsigned int numberOfMouseButtons_ = MouseButtonCode::numberOfButtons + 4
 Number of mouse buttons in KeyBinder (+4) More...
 

Constructor & Destructor Documentation

orxonox::KeyDetector::KeyDetector ( )
orxonox::KeyDetector::~KeyDetector ( )
orxonox::KeyDetector::KeyDetector ( const KeyDetector )
privatedelete

Member Function Documentation

void orxonox::KeyDetector::assignCommands ( )
private
void orxonox::KeyDetector::callback ( const std::string &  name)
private
void orxonox::KeyDetector::JoyStickQuantityChanged ( const std::vector< JoyStick * > &  joyStickList)
overrideprivatevirtual

Called whenever joy sticks get added/removed.

Reimplemented from orxonox::KeyBinder.

KeyDetector& orxonox::KeyDetector::operator= ( const KeyDetector )
privatedelete
void orxonox::KeyDetector::setCallback ( const FunctorPtr function)
inline

Friends And Related Function Documentation

friend class Singleton< KeyDetector >
friend

Member Data Documentation

FunctorPtr orxonox::KeyDetector::callbackFunction_
private
InputState* orxonox::KeyDetector::inputState_
private
KeyDetector* orxonox::KeyDetector::singletonPtr_s
staticprivate

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