Index: code/trunk/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSGraphics.cc	(revision 1879)
+++ code/trunk/src/orxonox/gamestates/GSGraphics.cc	(revision 1887)
@@ -114,4 +114,5 @@
         // Configure master input state with a KeyBinder
         //masterKeyBinder_ = new KeyBinder();
+        //masterKeyBinder_->loadBindings("master_keybindings.ini");
         //inputManager_->getMasterInputState()->addKeyHandler(masterKeyBinder_);
 
Index: code/trunk/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 1879)
+++ code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 1887)
@@ -36,4 +36,8 @@
 #include "core/input/KeyBinder.h"
 #include "core/Loader.h"
+#include "core/CommandExecutor.h"
+#include "core/ConsoleCommand.h"
+#include "core/ConfigValueIncludes.h"
+#include "core/CoreIncludes.h"
 #include "objects/Backlight.h"
 #include "objects/Tickable.h"
@@ -55,8 +59,15 @@
         , hud_(0)
     {
+        RegisterObject(GSLevel);
+        setConfigValues();
     }
 
     GSLevel::~GSLevel()
     {
+    }
+
+    void GSLevel::setConfigValues()
+    {
+        SetConfigValue(keyDetectorCallbackCode_, "KeybindBindingStringKeyName=");
     }
 
@@ -65,5 +76,5 @@
         inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game", 20);
         keyBinder_ = new KeyBinder();
-        keyBinder_->loadBindings();
+        keyBinder_->loadBindings("keybindings.ini");
         inputState_->setHandler(keyBinder_);
 
@@ -88,4 +99,14 @@
         // TODO: insert slomo console command with
         // .accessLevel(AccessLevel::Offline).defaultValue(0, 1.0).axisParamIndex(0).isAxisRelative(false);
+
+        // keybind console command
+        FunctorMember<GSLevel>* functor1 = createFunctor(&GSLevel::keybind);
+        functor1->setObject(this);
+        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "keybind"));
+        FunctorMember<GSLevel>* functor2 = createFunctor(&GSLevel::tkeybind);
+        functor2->setObject(this);
+        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor2, "tkeybind"));
+        // set our console command as callback for the key detector
+        InputManager::getInstance().setKeyDetectorCallback(std::string("keybind ") + keyDetectorCallbackCode_);
     }
 
@@ -145,3 +166,55 @@
         delete this->startLevel_;
     }
+
+    void GSLevel::keybind(const std::string &command)
+    {
+        this->keybindInternal(command, false);
+    }
+
+    void GSLevel::tkeybind(const std::string &command)
+    {
+        this->keybindInternal(command, true);
+    }
+
+    /**
+    @brief
+        Assigns a command string to a key/button/axis. The name is determined via KeyDetector.
+    @param command
+        Command string that can be executed by the CommandExecutor
+        OR: Internal string "KeybindBindingStringKeyName=" used for the second call to identify
+        the key/button/axis that has been activated. This is configured above in enter().
+    */
+    void GSLevel::keybindInternal(const std::string& command, bool bTemporary)
+    {
+        static std::string bindingString = "";
+        static bool bTemporarySaved = false;
+        static bool bound = true;
+        // note: We use a long name to make 'sure' that the user doesn't use it accidentally.
+        // Howerver there will be no real issue if it happens anyway.
+        if (command.find(keyDetectorCallbackCode_) != 0)
+        {
+            if (bound)
+            {
+                COUT(0) << "Press any button/key or move a mouse/joystick axis" << std::endl;
+                InputManager::getInstance().requestEnterState("detector");
+                bindingString = command;
+                bTemporarySaved = bTemporary;
+                bound = false;
+            }
+            //else:  We're still in a keybind command. ignore this call.
+        }
+        else
+        {
+            if (!bound)
+            {
+                // user has pressed the key
+                std::string name = command.substr(this->keyDetectorCallbackCode_.size());
+                COUT(0) << "Binding string \"" << bindingString << "\" on key '" << name << "'" << std::endl;
+                this->keyBinder_->setBinding(bindingString, name, bTemporarySaved);
+                InputManager::getInstance().requestLeaveState("detector");
+                bound = true;
+            }
+            // else: A key was pressed within the same tick, ignore it.
+        }
+    }
 }
Index: code/trunk/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.h	(revision 1879)
+++ code/trunk/src/orxonox/gamestates/GSLevel.h	(revision 1887)
@@ -37,6 +37,7 @@
 namespace orxonox
 {
-    class _OrxonoxExport GSLevel : public GameState<GSGraphics>
+    class _OrxonoxExport GSLevel : public GameState<GSGraphics>, public OrxonoxClass
     {
+        friend class ClassIdentifier<GSLevel>;
     public:
         GSLevel(const std::string& name);
@@ -58,4 +59,9 @@
         float timeFactor_;       //!< A factor to change the gamespeed
 
+        // console commands
+        void keybind(const std::string& command);
+        void tkeybind(const std::string& command);
+        void keybindInternal(const std::string& command, bool bTemporary);
+
         Ogre::SceneManager*   sceneManager_;
         KeyBinder*            keyBinder_;        //!< tool that loads and manages the input bindings
@@ -64,4 +70,11 @@
         Level*                startLevel_;       //!< current hard coded default level
         Level*                hud_;              //!< 'level' object fo the HUD
+
+        // config values
+        std::string           keyDetectorCallbackCode_;
+        
+    private:
+        void setConfigValues();
+
     };
 }
Index: code/trunk/src/orxonox/gui/GUIManager.cc
===================================================================
--- code/trunk/src/orxonox/gui/GUIManager.cc	(revision 1879)
+++ code/trunk/src/orxonox/gui/GUIManager.cc	(revision 1887)
@@ -279,5 +279,5 @@
     }
 
-    void GUIManager::mouseButtonPressed(MouseButton::Enum id)
+    void GUIManager::mouseButtonPressed(MouseButtonCode::ByEnum id)
     {
         try
@@ -292,5 +292,5 @@
     }
 
-    void GUIManager::mouseButtonReleased(MouseButton::Enum id)
+    void GUIManager::mouseButtonReleased(MouseButtonCode::ByEnum id)
     {
         try
@@ -306,21 +306,21 @@
 
 
-    inline CEGUI::MouseButton GUIManager::convertButton(MouseButton::Enum button)
+    inline CEGUI::MouseButton GUIManager::convertButton(MouseButtonCode::ByEnum button)
     {
         switch (button)
         {
-        case MouseButton::Left:
+        case MouseButtonCode::Left:
             return CEGUI::LeftButton;
 
-        case MouseButton::Right:
+        case MouseButtonCode::Right:
             return CEGUI::RightButton;
 
-        case MouseButton::Middle:
+        case MouseButtonCode::Middle:
             return CEGUI::MiddleButton;
 
-        case MouseButton::Button3:
+        case MouseButtonCode::Button3:
             return CEGUI::X1Button;
 
-        case MouseButton::Button4:
+        case MouseButtonCode::Button4:
             return CEGUI::X2Button;
 
Index: code/trunk/src/orxonox/gui/GUIManager.h
===================================================================
--- code/trunk/src/orxonox/gui/GUIManager.h	(revision 1879)
+++ code/trunk/src/orxonox/gui/GUIManager.h	(revision 1887)
@@ -93,7 +93,7 @@
         { }
 
-        void mouseButtonPressed (MouseButton::Enum id);
-        void mouseButtonReleased(MouseButton::Enum id);
-        void mouseButtonHeld    (MouseButton::Enum id)
+        void mouseButtonPressed (MouseButtonCode::ByEnum id);
+        void mouseButtonReleased(MouseButtonCode::ByEnum id);
+        void mouseButtonHeld    (MouseButtonCode::ByEnum id)
         { }
         void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
@@ -123,5 +123,5 @@
         State state_;
 
-        static CEGUI::MouseButton convertButton(MouseButton::Enum button);
+        static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button);
 
         static GUIManager*        singletonRef_s;
