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

Handles the KeyBinders and supplies them throughout the game. More...

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

Inheritance diagram for orxonox::KeyBinderManager:
orxonox::Singleton< KeyBinderManager > orxonox::Configurable orxonox::Listable orxonox::Identifiable

Public Member Functions

 KeyBinderManager ()
 
 ~KeyBinderManager ()
 
KeyBinderget (const std::string &name)
 Returns a pointer to a KeyBinder (creates it if not yet loaded) More...
 
InputHandlergetAsHandler (const std::string &name)
 Like get() but return value is of type InputHandler* (so you don't have to include KeyBinder.h) More...
 
KeyBindergetCurrent ()
 Returns the currently selected KeyBinder. More...
 
InputHandlergetCurrentAsHandler ()
 Like getCurrent(), but returns it as InputHandler* (so you don't have to include KeyBinder.h) More...
 
KeyBindergetDefault ()
 Returns the default KeyBinder. More...
 
InputHandlergetDefaultAsHandler ()
 Returns the default KeyBinder as InputHandler* (so you don't have to include KeyBinder.h) More...
 
const std::string & getDefaultFilename ()
 Returns the filename of the default key bindings. More...
 
void keybind (const std::string &command)
 Bind 'command' to any key pressed after this call (use with care!) More...
 
void load (const std::string &filename)
 Loads a KeyBinder by creating it (no different from get() except for the return value) More...
 
void registerKeybindCallback (LuaFunctor *function)
 
void setConfigValues ()
 
void setCurrent (const std::string &filename)
 Selects the current KeyBinder and creates it if not yet loaded. More...
 
void setToDefault ()
 Selects the default KeyBinder as current one. More...
 
void tkeybind (const std::string &command)
 Bind 'command' to any key pressed after this call (use with care!), but temporarily (no file save) More...
 
void tunbind (const std::string &binding)
 
void unbind (const std::string &binding)
 
void unload (const std::string &filename)
 Destroys a KeyBinder completely (does nothing if not yet loaded) More...
 
- Public Member Functions inherited from orxonox::Configurable
 Configurable ()
 
void setConfigValues ()
 Function to collect the SetConfigValue-macro calls. More...
 
- 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...
 

Static Public Member Functions

static KeyBinderManagergetInstance ()
 
- Static Public Member Functions inherited from orxonox::Singleton< KeyBinderManager >
static bool exists ()
 Tells whether the singleton has been created. More...
 
static KeyBinderManagergetInstance ()
 Returns a reference to the singleton instance. More...
 

Private Member Functions

 KeyBinderManager (const KeyBinderManager &)=delete
 
void defaultFilenameChanged ()
 
void keybindInternal (const std::string &command, bool bTemporary)
 
void keybindKeyPressed (const std::string &keyName)
 
KeyBinderManageroperator= (const KeyBinderManager &)=delete
 

Private Attributes

bool bBinding_
 Function to be called when key was pressed after "keybind" command. More...
 
bool bDefaultFileLoaded_
 All loaded KeyBinders. More...
 
std::map< std::string, KeyBinder * > binders_
 Currently selected KeyBinder (never nullptr!) More...
 
bool bTemporary_
 Tells whether a key binding process is active. More...
 
std::shared_ptr< LuaFunctorcallbackFunction_
 Name of the file with the default key bindings. More...
 
std::string command_
 Stores tkeybind/keybind value. More...
 
KeyBindercurrentBinder_
 
std::string defaultFilename_
 Tells whether the default one is loaded. More...
 

Static Private Attributes

static KeyBinderManagersingletonPtr_s
 Stores the command received by (t)keybind. More...
 

Friends

class Singleton< KeyBinderManager >
 

Additional Inherited Members

- Protected Member Functions inherited from orxonox::Singleton< KeyBinderManager >
 Singleton ()
 Constructor sets the singleton instance pointer. More...
 
virtual ~Singleton ()
 Destructor resets the singleton instance pointer. More...
 

Detailed Description

Handles the KeyBinders and supplies them throughout the game.

This interface merely serves to provide a static "keybind" command that always maps to the currently active KeyBinder. You can set that with setCurrent(). There is also a default one, retrieved with getDefault(). The idea is that mostly the default KeyBinder is active except for special situations (mini-game for inst).

Remarks
You are not forced to use the KeyBinder imposed by getCurrent(). But be aware that "keybind" will not work as expected!

Constructor & Destructor Documentation

orxonox::KeyBinderManager::KeyBinderManager ( )
orxonox::KeyBinderManager::~KeyBinderManager ( )
orxonox::KeyBinderManager::KeyBinderManager ( const KeyBinderManager )
privatedelete

Member Function Documentation

void orxonox::KeyBinderManager::defaultFilenameChanged ( )
private
KeyBinder * orxonox::KeyBinderManager::get ( const std::string &  name)

Returns a pointer to a KeyBinder (creates it if not yet loaded)

InputHandler * orxonox::KeyBinderManager::getAsHandler ( const std::string &  name)

Like get() but return value is of type InputHandler* (so you don't have to include KeyBinder.h)

KeyBinder* orxonox::KeyBinderManager::getCurrent ( )
inline

Returns the currently selected KeyBinder.

InputHandler * orxonox::KeyBinderManager::getCurrentAsHandler ( )

Like getCurrent(), but returns it as InputHandler* (so you don't have to include KeyBinder.h)

KeyBinder* orxonox::KeyBinderManager::getDefault ( )
inline

Returns the default KeyBinder.

InputHandler * orxonox::KeyBinderManager::getDefaultAsHandler ( )

Returns the default KeyBinder as InputHandler* (so you don't have to include KeyBinder.h)

const std::string& orxonox::KeyBinderManager::getDefaultFilename ( )
inline

Returns the filename of the default key bindings.

static KeyBinderManager& orxonox::KeyBinderManager::getInstance ( )
inlinestatic
void orxonox::KeyBinderManager::keybind ( const std::string &  command)
inline

Bind 'command' to any key pressed after this call (use with care!)

void orxonox::KeyBinderManager::keybindInternal ( const std::string &  command,
bool  bTemporary 
)
private
void orxonox::KeyBinderManager::keybindKeyPressed ( const std::string &  keyName)
private
void orxonox::KeyBinderManager::load ( const std::string &  filename)

Loads a KeyBinder by creating it (no different from get() except for the return value)

KeyBinderManager& orxonox::KeyBinderManager::operator= ( const KeyBinderManager )
privatedelete
void orxonox::KeyBinderManager::registerKeybindCallback ( LuaFunctor function)
void orxonox::KeyBinderManager::setConfigValues ( void  )
void orxonox::KeyBinderManager::setCurrent ( const std::string &  filename)

Selects the current KeyBinder and creates it if not yet loaded.

void orxonox::KeyBinderManager::setToDefault ( )
inline

Selects the default KeyBinder as current one.

void orxonox::KeyBinderManager::tkeybind ( const std::string &  command)
inline

Bind 'command' to any key pressed after this call (use with care!), but temporarily (no file save)

void orxonox::KeyBinderManager::tunbind ( const std::string &  binding)
inline
void orxonox::KeyBinderManager::unbind ( const std::string &  binding)
inline
void orxonox::KeyBinderManager::unload ( const std::string &  filename)

Destroys a KeyBinder completely (does nothing if not yet loaded)

Friends And Related Function Documentation

friend class Singleton< KeyBinderManager >
friend

Member Data Documentation

bool orxonox::KeyBinderManager::bBinding_
private

Function to be called when key was pressed after "keybind" command.

bool orxonox::KeyBinderManager::bDefaultFileLoaded_
private

All loaded KeyBinders.

std::map<std::string, KeyBinder*> orxonox::KeyBinderManager::binders_
private

Currently selected KeyBinder (never nullptr!)

bool orxonox::KeyBinderManager::bTemporary_
private

Tells whether a key binding process is active.

std::shared_ptr<LuaFunctor> orxonox::KeyBinderManager::callbackFunction_
private

Name of the file with the default key bindings.

std::string orxonox::KeyBinderManager::command_
private

Stores tkeybind/keybind value.

KeyBinder* orxonox::KeyBinderManager::currentBinder_
private
std::string orxonox::KeyBinderManager::defaultFilename_
private

Tells whether the default one is loaded.

KeyBinderManager* orxonox::KeyBinderManager::singletonPtr_s
staticprivate

Stores the command received by (t)keybind.


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