Index: /code/branches/input/src/core/InputBuffer.cc
===================================================================
--- /code/branches/input/src/core/InputBuffer.cc	(revision 1181)
+++ /code/branches/input/src/core/InputBuffer.cc	(revision 1182)
@@ -40,5 +40,5 @@
         //this->bActivated_ = false;
         this->allowedChars_ = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZäöüÄÖÜ0123456789 \\\"().:,;_-+*/=!?<>[|]";
-        this->keyboard_ = InputManager::getSingleton().getKeyboard();
+        this->keyboard_ = InputManager::getKeyboard();
         this->buffer_ = "";
 
Index: /code/branches/input/src/core/InputHandler.cc
===================================================================
--- /code/branches/input/src/core/InputHandler.cc	(revision 1181)
+++ /code/branches/input/src/core/InputHandler.cc	(revision 1182)
@@ -38,4 +38,5 @@
 #include "InputEvent.h"
 #include "InputManager.h"
+#include "core/CommandExecutor.h"
 
 namespace orxonox
@@ -68,7 +69,10 @@
     {
       // simply write the key number (i) in the string
-      this->bindingsKeyPressed_[i] = getConvertedValue<int, std::string>(i);
-      this->bindingsKeyReleased_[i] = getConvertedValue<int, std::string>(i);
-    }
+      this->bindingsKeyPress_[i] = "";
+      this->bindingsKeyRelease_[i] = "";
+    }
+    this->bindingsKeyPress_[OIS::KC_NUMPADENTER] = "setInputMode " + getConvertedValue<int, std::string>(IM_KEYBOARD);
+    this->bindingsKeyPress_[OIS::KC_ESCAPE] = "exit";
+    this->bindingsKeyHold_[OIS::KC_U] = "exec disco.txt";
     return true;
   }
@@ -80,61 +84,87 @@
   bool InputHandlerGame::keyPressed(const OIS::KeyEvent &e)
   {
-    if (e.key == OIS::KC_ESCAPE)
-    {
-      InputEvent e = {1, true, 0, 0, 0};
-      InputHandlerGame::callListeners(e);
-    }
-    else if (e.key == OIS::KC_NUMPADENTER)
-    {
-      InputManager::getSingleton().setInputMode(IM_KEYBOARD);
-    }
-    else
+    this->keysDown_.push_back(e.key);
+    // find the appropriate key binding
+    std::string cmdStr = bindingsKeyPress_[int(e.key)];
+    if (cmdStr != "")
+    {
+      CommandExecutor::execute(cmdStr);
+      COUT(3) << "Executing command: " << cmdStr << std::endl;
+    }
+    return true;
+  }
+
+  /**
+    @brief Event handler for the keyReleased Event.
+    @param e Event information
+  */
+  bool InputHandlerGame::keyReleased(const OIS::KeyEvent &e)
+  {
+    // remove the key from the keysDown_ list
+    for (std::list<OIS::KeyCode>::iterator it = keysDown_.begin(); it != keysDown_.end(); it++)
+    {
+      if (*it == e.key)
+      {
+        keysDown_.erase(it);
+        break;
+      }
+    }
+
+    // find the appropriate key binding
+    std::string cmdStr = bindingsKeyRelease_[int(e.key)];
+    if (cmdStr != "")
+    {
+      CommandExecutor::execute(cmdStr);
+      COUT(3) << "Executing command: " << cmdStr << std::endl;
+    }
+    return true;
+  }
+
+  /**
+    @brief Event handler for the mouseMoved Event.
+    @param e Event information
+  */
+  bool InputHandlerGame::mouseMoved(const OIS::MouseEvent &e)
+  {
+    return true;
+  }
+
+  /**
+    @brief Event handler for the mousePressed Event.
+    @param e Event information
+    @param id The ID of the mouse button
+  */
+  bool InputHandlerGame::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
+  {
+    return true;
+  }
+
+  /**
+    @brief Event handler for the mouseReleased Event.
+    @param e Event information
+    @param id The ID of the mouse button
+  */
+  bool InputHandlerGame::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
+  {
+    return true;
+  }
+
+  /**
+    @brief Tick method to do additional calculations.
+    @param dt Delta time.
+  */
+  void InputHandlerGame::tick(float dt)
+  {
+    // iterate through all the pressed keys
+    for (std::list<OIS::KeyCode>::iterator it = keysDown_.begin(); it != keysDown_.end(); it++)
     {
       // find the appropriate key binding
-      std::string cmdStr = bindingsKeyPressed_[int(e.key)];
-      //COUT(3) << cmdStr << " pressed" << std::endl;
-    }
-    return true;
-  }
-
-  /**
-    @brief Event handler for the keyReleased Event.
-    @param e Event information
-  */
-  bool InputHandlerGame::keyReleased(const OIS::KeyEvent &e)
-  {
-    // find the appropriate key binding
-    std::string cmdStr = bindingsKeyReleased_[int(e.key)];
-    //COUT(3) << cmdStr << " released" << std::endl;
-    return true;
-  }
-
-  /**
-    @brief Event handler for the mouseMoved Event.
-    @param e Event information
-  */
-  bool InputHandlerGame::mouseMoved(const OIS::MouseEvent &e)
-  {
-    return true;
-  }
-
-  /**
-    @brief Event handler for the mousePressed Event.
-    @param e Event information
-    @param id The ID of the mouse button
-  */
-  bool InputHandlerGame::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
-  {
-    return true;
-  }
-
-  /**
-    @brief Event handler for the mouseReleased Event.
-    @param e Event information
-    @param id The ID of the mouse button
-  */
-  bool InputHandlerGame::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
-  {
-    return true;
+      std::string cmdStr = bindingsKeyHold_[*it];
+      if (cmdStr != "")
+      {
+        CommandExecutor::execute(cmdStr);
+        COUT(3) << "Executing command: " << cmdStr << std::endl;
+      }
+    }
   }
 
@@ -226,3 +256,12 @@
   }
 
+  /**
+    @brief Tick method to do additional calculations.
+    @param dt Delta time.
+  */
+  void InputHandlerGUI::tick(float dt)
+  {
+    
+  }
+
 }
Index: /code/branches/input/src/core/InputHandler.h
===================================================================
--- /code/branches/input/src/core/InputHandler.h	(revision 1181)
+++ /code/branches/input/src/core/InputHandler.h	(revision 1182)
@@ -38,4 +38,5 @@
 
 #include <string>
+#include <list>
 #include <OIS/OIS.h>
 
@@ -44,10 +45,26 @@
 namespace orxonox
 {
+  namespace KeybindSetting
+  {
+    enum KeybindSetting
+    {
+      None,
+      OnPress,
+      OnRelease,
+      Continuous,
+    };
+  }
+
+  class _CoreExport BaseInputHandler
+      : public OIS::KeyListener, public OIS::MouseListener
+  {
+    virtual void tick(float dt) = 0;
+  };
+    
   /**
     @brief Captures mouse and keyboard input while in the actual game mode.
     Manages the key bindings.
   */
-  class _CoreExport InputHandlerGame
-        : public OIS::KeyListener, public OIS::MouseListener
+  class _CoreExport InputHandlerGame : public BaseInputHandler
   {
   public:
@@ -65,6 +82,11 @@
 		bool keyReleased  (const OIS::KeyEvent   &arg);
 
+    void tick(float dt);
+
     // temporary hack
     void callListeners(InputEvent &evt);
+
+    //! Stores all the keys that are down
+    std::list<OIS::KeyCode> keysDown_;
 
     /** denotes the maximum number of different keys there are in OIS.
@@ -72,7 +94,9 @@
     static const int numberOfKeys_s = 256;
     //! Array of input events for every pressed key
-    std::string bindingsKeyPressed_[numberOfKeys_s];
+    std::string bindingsKeyPress_[numberOfKeys_s];
     //! Array of input events for every released key
-    std::string bindingsKeyReleased_[numberOfKeys_s];
+    std::string bindingsKeyRelease_[numberOfKeys_s];
+    //! Array of input events for every holding key
+    std::string bindingsKeyHold_[numberOfKeys_s];
 
     /** denotes the maximum number of different buttons there are in OIS.
@@ -91,10 +115,11 @@
     GUI.
   */
-  class _CoreExport InputHandlerGUI
-        : public OIS::KeyListener, public OIS::MouseListener
+  class _CoreExport InputHandlerGUI : public BaseInputHandler
   {
   public:
     InputHandlerGUI ();
     ~InputHandlerGUI();
+
+    void tick(float dt);
 
   private:
Index: /code/branches/input/src/core/InputManager.cc
===================================================================
--- /code/branches/input/src/core/InputManager.cc	(revision 1181)
+++ /code/branches/input/src/core/InputManager.cc	(revision 1182)
@@ -36,13 +36,10 @@
 #include "CoreIncludes.h"
 #include "Debug.h"
-#include "InputEventListener.h"
-#include "InputHandler.h"
 #include "InputBuffer.h"
 #include "ConsoleCommand.h"
+#include "util/Convert.h"
 
 namespace orxonox
 {
-  ConsoleCommand(InputManager, setInputMode, AccessLevel::Admin, true).setDefaultValue(0, IM_INGAME);
-
   /**
     @brief Constructor only resets the pointer values to 0.
@@ -50,16 +47,7 @@
   InputManager::InputManager() :
       inputSystem_(0), keyboard_(0), mouse_(0),
-      currentMode_(IM_UNINIT), setMode_(IM_UNINIT),
-      handlerGUI_(0), handlerBuffer_(0), handlerGame_(0)
+      state_(IS_UNINIT), stateRequest_(IS_UNINIT)
   {
     RegisterObject(InputManager);
-  }
-
-  /**
-    @brief Destructor only called at the end of the program
-  */
-  InputManager::~InputManager()
-  {
-    this->destroy();
   }
 
@@ -68,8 +56,16 @@
     @return A reference to the only instance of the InputManager
   */
-  InputManager& InputManager::getSingleton()
+  InputManager& InputManager::_getSingleton()
   {
     static InputManager theOnlyInstance;
     return theOnlyInstance;
+  }
+
+  /**
+    @brief Destructor only called at the end of the program
+  */
+  InputManager::~InputManager()
+  {
+    this->_destroy();
   }
 
@@ -81,7 +77,7 @@
     @param windowHeight The height of the render window
   */
-  bool InputManager::initialise(size_t windowHnd, int windowWidth, int windowHeight)
-  {
-    if (!this->inputSystem_)
+  bool InputManager::_initialise(size_t windowHnd, int windowWidth, int windowHeight)
+  {
+    if (!inputSystem_)
     {
       // Setup basic variables
@@ -93,7 +89,7 @@
       paramList.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
 
-#if defined OIS_LINUX_PLATFORM
-      paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
-#endif
+//#if defined OIS_LINUX_PLATFORM
+//      paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
+//#endif
 
       try
@@ -107,4 +103,6 @@
         COUT(ORX_DEBUG) << "*** InputManager: Created OIS mouse" << std::endl;
 
+        //TODO: check for already pressed keys
+
         // create a mouse. If none are available the exception is caught.
         mouse_ = static_cast<OIS::Mouse*>(inputSystem_->createInputObject(OIS::OISMouse, true));
@@ -112,5 +110,7 @@
 
         // Set mouse region
-        this->setWindowExtents(windowWidth, windowHeight);
+        setWindowExtents(windowWidth, windowHeight);
+
+        this->state_ = IS_NONE;
       }
       catch (OIS::Exception ex)
@@ -118,26 +118,32 @@
         // something went wrong with the initialisation
         COUT(ORX_ERROR) << "Error: Failed creating an input system/keyboard/mouse. Message: \"" << ex.eText << "\"" << std::endl;
-        this->inputSystem_ = 0;
+        inputSystem_ = 0;
         return false;
       }
     }
 
-    // create the handlers
-    this->handlerGUI_ = new InputHandlerGUI();
-    this->handlerGame_ = new InputHandlerGame();
-    //this->handlerBuffer_ = new InputBuffer();
-    this->handlerGame_->loadBindings();
-
-    /*COUT(ORX_DEBUG) << "*** InputManager: Loading key bindings..." << std::endl;
-    // load the key bindings
-    InputEvent empty = {0, false, 0, 0, 0};
-    for (int i = 0; i < this->numberOfKeys_; i++)
-      this->bindingsKeyPressed_[i] = empty;
-
-    //assign 'abort' to the escape key
-    this->bindingsKeyPressed_[(int)OIS::KC_ESCAPE].id = 1;
-    COUT(ORX_DEBUG) << "*** InputManager: Loading done." << std::endl;*/
-
-    return true;
+    keyboard_->setEventCallback(this);
+    mouse_->setEventCallback(this);
+
+    addKeyListener(new InputBuffer(), "buffer");
+
+    _loadBindings();
+
+    COUT(ORX_DEBUG) << "*** InputManager: Loading done." << std::endl;
+
+    return true;
+  }
+
+  void InputManager::_loadBindings()
+  {
+    for (int i = 0; i < numberOfKeys_s; i++)
+    {
+      // simply write the key number (i) in the string
+      this->bindingsKeyPress_[i] = "";
+      this->bindingsKeyRelease_[i] = "";
+    }
+    this->bindingsKeyPress_[OIS::KC_NUMPADENTER] = "activateConsole";
+    this->bindingsKeyPress_[OIS::KC_ESCAPE] = "exit";
+    this->bindingsKeyHold_[OIS::KC_U] = "exec disco.txt";
   }
 
@@ -145,28 +151,25 @@
     @brief Destroys all the created input devices and handlers.
   */
-  void InputManager::destroy()
+  void InputManager::_destroy()
   {
     COUT(ORX_DEBUG) << "*** InputManager: Destroying ..." << std::endl;
-    if (this->mouse_)
-      this->inputSystem_->destroyInputObject(mouse_);
-    if (this->keyboard_)
-      this->inputSystem_->destroyInputObject(keyboard_);
-    if (this->inputSystem_)
-      OIS::InputManager::destroyInputSystem(this->inputSystem_);
-
-    this->mouse_         = 0;
-    this->keyboard_      = 0;
-    this->inputSystem_   = 0;
-
-    if (this->handlerBuffer_)
-      delete this->handlerBuffer_;
-    if (this->handlerGame_)
-      delete this->handlerGame_;
-    if (this->handlerGUI_)
-      delete this->handlerGUI_;
-
-    this->handlerBuffer_ = 0;
-    this->handlerGame_   = 0;
-    this->handlerGUI_    = 0;
+    if (mouse_)
+      inputSystem_->destroyInputObject(mouse_);
+    if (keyboard_)
+      inputSystem_->destroyInputObject(keyboard_);
+    if (inputSystem_)
+      OIS::InputManager::destroyInputSystem(inputSystem_);
+
+    mouse_         = 0;
+    keyboard_      = 0;
+    inputSystem_   = 0;
+
+    OIS::KeyListener* buffer = keyListeners_["buffer"];
+    if (buffer)
+    {
+      this->removeKeyListener("buffer");
+      delete buffer;
+      buffer = 0;
+    }
 
     COUT(ORX_DEBUG) << "*** InputManager: Destroying done." << std::endl;
@@ -179,27 +182,30 @@
   void InputManager::tick(float dt)
   {
+    if (state_ == IS_UNINIT)
+      return;
+
     // reset the game if it has changed
-    if (this->currentMode_ != this->setMode_)
-    {
-      switch (this->setMode_)
-      {
-      case IM_GUI:
-        this->mouse_->setEventCallback(this->handlerGUI_);
-        this->keyboard_->setEventCallback(this->handlerGUI_);
+    if (state_ != stateRequest_)
+    {
+      if (stateRequest_ != IS_CUSTOM)
+        _setDefaultState();
+
+      switch (stateRequest_)
+      {
+      case IS_NORMAL:
         break;
-      case IM_INGAME:
-        this->mouse_->setEventCallback(this->handlerGame_);
-        this->keyboard_->setEventCallback(this->handlerGame_);
+      case IS_GUI:
+        //FIXME: do stuff
         break;
-      case IM_KEYBOARD:
-        this->mouse_->setEventCallback(this->handlerGame_);
-        this->keyboard_->setEventCallback(this->handlerBuffer_);
+      case IS_CONSOLE:
+        if (this->keyListeners_.find("buffer") != this->keyListeners_.end())
+          this->activeKeyListeners_.push_back(this->keyListeners_["buffer"]);
+        this->bDefaultKeyInput = false;
         break;
-      case IM_UNINIT:
-        this->mouse_->setEventCallback(0);
-        this->keyboard_->setEventCallback(0);
+      case IS_CUSTOM:
+        // don't do anything
         break;
       }
-      this->currentMode_ = this->setMode_;
+      state_ = stateRequest_;
     }
 
@@ -207,8 +213,134 @@
     if (mouse_)
       mouse_->capture();
-
     if (keyboard_)
       keyboard_->capture();
   }
+
+  void InputManager::_setDefaultState()
+  {
+    this->activeJoyStickListeners_.clear();
+    this->activeKeyListeners_.clear();
+    this->activeMouseListeners_.clear();
+    this->bDefaultKeyInput      = true;
+    this->bDefaultMouseInput    = true;
+    this->bDefaultJoyStickInput = true;
+  }
+
+
+  /**
+    @brief Event handler for the keyPressed Event.
+    @param e Event information
+  */
+  bool InputManager::keyPressed(const OIS::KeyEvent &e)
+  {
+    this->keysDown_.push_back(e.key);
+
+    if (this->bDefaultKeyInput)
+    {
+      // find the appropriate key binding
+      std::string cmdStr = bindingsKeyPress_[int(e.key)];
+      if (cmdStr != "")
+      {
+        CommandExecutor::execute(cmdStr);
+        COUT(3) << "Executing command: " << cmdStr << std::endl;
+      }
+    }
+    else
+    {
+      for (std::list<OIS::KeyListener*>::const_iterator it = activeKeyListeners_.begin(); it != activeKeyListeners_.end(); it++)
+        (*it)->keyPressed(e);
+    }
+    return true;
+  }
+
+  /**
+    @brief Event handler for the keyReleased Event.
+    @param e Event information
+  */
+  bool InputManager::keyReleased(const OIS::KeyEvent &e)
+  {
+    // remove the key from the keysDown_ list
+    for (std::list<OIS::KeyCode>::iterator it = keysDown_.begin(); it != keysDown_.end(); it++)
+    {
+      if (*it == e.key)
+      {
+        keysDown_.erase(it);
+        break;
+      }
+    }
+
+    if (this->bDefaultKeyInput)
+    {
+      // find the appropriate key binding
+      std::string cmdStr = bindingsKeyRelease_[int(e.key)];
+      if (cmdStr != "")
+      {
+        CommandExecutor::execute(cmdStr);
+        COUT(3) << "Executing command: " << cmdStr << std::endl;
+      }
+    }
+    else
+    {
+      for (std::list<OIS::KeyListener*>::const_iterator it = activeKeyListeners_.begin(); it != activeKeyListeners_.end(); it++)
+        (*it)->keyReleased(e);
+    }
+    return true;
+  }
+
+  /**
+    @brief Event handler for the mouseMoved Event.
+    @param e Event information
+  */
+  bool InputManager::mouseMoved(const OIS::MouseEvent &e)
+  {
+    return true;
+  }
+
+  /**
+    @brief Event handler for the mousePressed Event.
+    @param e Event information
+    @param id The ID of the mouse button
+  */
+  bool InputManager::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
+  {
+    return true;
+  }
+
+  /**
+    @brief Event handler for the mouseReleased Event.
+    @param e Event information
+    @param id The ID of the mouse button
+  */
+  bool InputManager::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
+  {
+    return true;
+  }
+
+  bool InputManager::buttonPressed(const OIS::JoyStickEvent &arg, int button)
+  {
+    return true;
+  }
+
+  bool InputManager::buttonReleased(const OIS::JoyStickEvent &arg, int button)
+  {
+    return true;
+  }
+
+  bool InputManager::axisMoved(const OIS::JoyStickEvent &arg, int axis)
+  {
+    return true;
+  }
+
+  bool InputManager::sliderMoved(const OIS::JoyStickEvent &arg, int id)
+  {
+    return true;
+  }
+
+  bool InputManager::povMoved(const OIS::JoyStickEvent &arg, int id)
+  {
+    return true;
+  }
+
+
 
   /**
@@ -221,5 +353,5 @@
   {
     // Set mouse region (if window resizes, we should alter this to reflect as well)
-    const OIS::MouseState &mouseState = mouse_->getMouseState();
+    const OIS::MouseState &mouseState = _getSingleton().mouse_->getMouseState();
     mouseState.width  = width;
     mouseState.height = height;
@@ -231,8 +363,7 @@
     @remark Only has an affect if the mode actually changes
   */
-  void InputManager::setInputMode(int mode)
-  {
-    if (mode > 0 && mode < 4)
-      getSingleton().setMode_ = (InputMode)mode;
+  void InputManager::setInputState(const InputState state)
+  {
+    _getSingleton().stateRequest_ = state;
   }
 
@@ -241,14 +372,52 @@
     @return The current input mode.
   */
-  InputMode InputManager::getInputMode()
-  {
-    return this->currentMode_;
-  }
-
-  void InputManager::feedInputBuffer(InputBuffer* buffer)
-  {
-    this->handlerBuffer_ = buffer;
-  }
-
+  InputManager::InputState InputManager::getInputState()
+  {
+    return _getSingleton().state_;
+  }
+
+  void InputManager::destroy()
+  {
+    _getSingleton()._destroy();
+  }
+
+  bool InputManager::initialise(size_t windowHnd, int windowWidth, int windowHeight)
+  {
+    return _getSingleton()._initialise(windowHnd, windowWidth, windowHeight);
+  }
+
+  bool InputManager::addKeyListener(OIS::KeyListener *listener, const std::string& name)
+  {
+    if (_getSingleton().keyListeners_.find(name) == _getSingleton().keyListeners_.end())
+    {
+      _getSingleton().keyListeners_[name] = listener;
+      return true;
+    }
+    else
+      return false;
+  }
+
+  bool InputManager::removeKeyListener(const std::string &name)
+  {
+    std::map<std::string, OIS::KeyListener*>::iterator it = _getSingleton().keyListeners_.find(name);
+    if (it != _getSingleton().keyListeners_.end())
+    {
+      _getSingleton().keyListeners_.erase(it);
+      return true;
+    }
+    else
+      return false;
+  }
+
+  OIS::KeyListener* InputManager::getKeyListener(const std::string& name)
+  {
+    std::map<std::string, OIS::KeyListener*>::iterator it = _getSingleton().keyListeners_.find(name);
+    if (it != _getSingleton().keyListeners_.end())
+    {
+      return (*it).second;
+    }
+    else
+      return 0;
+  }
 
 }
Index: /code/branches/input/src/core/InputManager.h
===================================================================
--- /code/branches/input/src/core/InputManager.h	(revision 1181)
+++ /code/branches/input/src/core/InputManager.h	(revision 1182)
@@ -38,4 +38,6 @@
 #include "CorePrereqs.h"
 
+#include <map>
+#include <list>
 #include <OIS/OIS.h>
 
@@ -46,18 +48,4 @@
 {
   /**
-    @brief Designates the way input is handled currently.
-    IM_GUI:      All the OIS input events are passed to CEGUI
-    IM_KEYBOARD: Only keyboard input is captured and passed to the InputBuffer
-    IM_INGAME:   Normal game mode. Key bindings and mouse are active.
-  */
-  enum InputMode
-  {
-    IM_GUI      = 0,
-    IM_KEYBOARD = 1,
-    IM_INGAME   = 2,
-    IM_UNINIT   = 3,
-  };
-
-  /**
     @brief Captures and distributes mouse and keyboard input.
     It resolves the key bindings to InputEvents which can be heard by
@@ -65,23 +53,61 @@
   */
   class _CoreExport InputManager
-        : public Tickable
+        : public Tickable,
+          public OIS::MouseListener, public OIS::KeyListener, public OIS::JoyStickListener
   {
   public:
-    bool initialise(size_t windowHnd, int windowWidth, int windowHeight);
-    void destroy();
+    /**
+      @brief Designates the way input is handled currently.
+      IM_GUI:    All the OIS input events are passed to CEGUI
+      IM_BUFFER: Only keyboard input is captured and passed to the InputBuffer
+      IM_NORMAL: Normal game mode. Key bindings and mouse are active.
+    */
+    enum InputState
+    {
+      IS_UNINIT,
+      IS_NONE,
+      IS_NORMAL,
+      IS_GUI,
+      IS_CONSOLE,
+      IS_CUSTOM
+    };
+
+  public:
     void tick(float dt);
-    void setWindowExtents(int width, int height);
-    InputMode getInputMode();
 
-    // temporary hack
-    void feedInputBuffer(InputBuffer* buffer);
+    static bool initialise(size_t windowHnd, int windowWidth, int windowHeight);
+    static void destroy();
+
+    static void setWindowExtents(int width, int height);
+    static void setInputState(const InputState state);
+    static InputState getInputState();
+
+    static bool addKeyListener(OIS::KeyListener* listener, const std::string& name);
+    //static bool removeKeyListener(OIS::KeyListener* listener);
+    static bool removeKeyListener(const std::string& name);
+    static bool enableKeyListener(const std::string& name);
+    static bool disableKeyListener(const std::string& name);
+    static OIS::KeyListener* getKeyListener(const std::string& name);
+    static bool isKeyListenerActive(const std::string& name);
+
+    static bool addMouseListener(OIS::MouseListener* listener, const std::string& name);
+    //static bool removeMouseListener(OIS::MouseListener* listener);
+    static bool removeMouseListener(const std::string& name);
+    static bool enableMouseListener(const std::string& name);
+    static bool disableMouseListener(const std::string& name);
+    static OIS::MouseListener* getMouseListener(const std::string& name);
+    static bool isMouseListenerActive(const std::string& name);
+
+    static bool addJoyStickListener(OIS::JoyStickListener* listener, const std::string& name);
+    //static bool removeJoyStickListener(OIS::JoyStickListener* listener);
+    static bool removeJoyStickListener(const std::string& name);
+    static bool enableJoyStickListener(const std::string& name);
+    static bool disableJoyStickListener(const std::string& name);
+    static OIS::JoyStickListener* getJoyStickListener(const std::string& name);
+    static bool isJoyStickListenerActive(const std::string& name);
 
     // Temporary solutions. Will be removed soon!
-    OIS::Mouse    *getMouse()    { return this->mouse_   ; }
-    OIS::Keyboard *getKeyboard() { return this->keyboard_; }
-
-    static InputManager& getSingleton();
-    static InputManager* getSingletonPtr() { return &getSingleton(); }
-    static void setInputMode(int mode);
+    static OIS::Mouse*    getMouse()    { return _getSingleton().mouse_   ; }
+    static OIS::Keyboard* getKeyboard() { return _getSingleton().keyboard_; }
 
   private:
@@ -91,17 +117,76 @@
     ~InputManager();
 
-    OIS::InputManager *inputSystem_;    //!< OIS input manager
-    OIS::Keyboard     *keyboard_;       //!< OIS mouse
-    OIS::Mouse        *mouse_;          //!< OIS keyboard
+    bool _initialise(size_t windowHnd, int windowWidth, int windowHeight);
+    void _destroy();
+    void _setDefaultState();
+    void _loadBindings();
 
-    InputMode          currentMode_;    //!< Input mode currently used
-    InputMode          setMode_;        //!< Input mode that has been set lately
-    InputHandlerGUI   *handlerGUI_;     //!< Handles the input if in GUI mode
-    // FIXME: insert the InputBuffer once merged with core2
-    InputBuffer       *handlerBuffer_;  //!< Handles the input if in Buffer mode
-    InputHandlerGame  *handlerGame_;    //!< Handles the input if in Game mode
+    // input events
+		bool mousePressed  (const OIS::MouseEvent    &arg, OIS::MouseButtonID id);
+		bool mouseReleased (const OIS::MouseEvent    &arg, OIS::MouseButtonID id);
+    bool mouseMoved    (const OIS::MouseEvent    &arg);
+		bool keyPressed    (const OIS::KeyEvent      &arg);
+		bool keyReleased   (const OIS::KeyEvent      &arg);
+		bool buttonPressed (const OIS::JoyStickEvent &arg, int button);
+		bool buttonReleased(const OIS::JoyStickEvent &arg, int button);
+		bool axisMoved     (const OIS::JoyStickEvent &arg, int axis);
+		bool sliderMoved   (const OIS::JoyStickEvent &arg, int id);
+		bool povMoved      (const OIS::JoyStickEvent &arg, int id);
 
-    //! Pointer to the instance of the singleton
-    //static InputManager *singletonRef_s;
+    static InputManager& _getSingleton();
+    static InputManager* _getSingletonPtr() { return &_getSingleton(); }
+
+  private:
+    OIS::InputManager* inputSystem_;    //!< OIS input manager
+    OIS::Keyboard*     keyboard_;       //!< OIS mouse
+    OIS::Mouse*        mouse_;          //!< OIS keyboard
+
+    InputState state_;
+    InputState stateRequest_;
+
+    std::list<OIS::KeyCode> keysDown_;
+
+    bool bDefaultKeyInput;
+    bool bDefaultMouseInput;
+    bool bDefaultJoyStickInput;
+
+    std::map<std::string, OIS::KeyListener*>      keyListeners_;
+    std::list<OIS::KeyListener*>                  activeKeyListeners_;
+    std::map<std::string, OIS::MouseListener*>    mouseListeners_;
+    std::list<OIS::MouseListener*>                activeMouseListeners_;
+    std::map<std::string, OIS::JoyStickListener*> joystickListeners_;
+    std::list<OIS::JoyStickListener*>             activeJoyStickListeners_;
+
+
+    /** denotes the maximum number of different keys there are in OIS.
+        256 should be ok since the highest number in the enum is 237. */
+    static const int numberOfKeys_s = 256;
+    //! Array of input events for every pressed key
+    std::string bindingsKeyPress_  [numberOfKeys_s];
+    //! Array of input events for every released key
+    std::string bindingsKeyRelease_[numberOfKeys_s];
+    //! Array of input events for every held key
+    std::string bindingsKeyHold_   [numberOfKeys_s];
+
+    /** denotes the maximum number of different buttons there are in OIS.
+        16 should be ok since the highest number in the enum is 7. */
+    static const int numberOfMouseButtons_s = 16;
+    //! Array of input events for every pressed mouse button
+    std::string bindingsMouseButtonPress_  [numberOfMouseButtons_s];
+    //! Array of input events for every released mouse button
+    std::string bindingsMouseButtonRelease_[numberOfMouseButtons_s];
+    //! Array of input events for every held mouse button
+    std::string bindingsMouseButtonHold_   [numberOfMouseButtons_s];
+
+    /** denotes the maximum number of different buttons there are in OIS.
+        32 should be ok. */
+    static const int numberOfJoyStickButtons_s = 32;
+    //! Array of input events for every pressed joystick button
+    std::string bindingsJoyStickButtonPress_  [numberOfJoyStickButtons_s];
+    //! Array of input events for every released joystick button
+    std::string bindingsJoyStickButtonRelease_[numberOfJoyStickButtons_s];
+    //! Array of input events for every held joystick button
+    std::string bindingsJoyStickButtonHold_   [numberOfJoyStickButtons_s];
+
   };
 }
Index: /code/branches/input/src/orxonox/Orxonox.cc
===================================================================
--- /code/branches/input/src/orxonox/Orxonox.cc	(revision 1181)
+++ /code/branches/input/src/orxonox/Orxonox.cc	(revision 1182)
@@ -84,8 +84,8 @@
 namespace orxonox
 {
-  ConsoleCommand(Orxonox, exit, AccessLevel::None, true);
-  ConsoleCommand(Orxonox, slomo, AccessLevel::Offline, true).setDefaultValue(0, 1.0);
-  ConsoleCommand(Orxonox, setTimeFactor, AccessLevel::Offline, false).setDefaultValue(0, 1.0);
-
+  ConsoleCommandShortcut(Orxonox, exit, AccessLevel::None);
+  ConsoleCommandShortcut(Orxonox, slomo, AccessLevel::Offline).setDefaultValue(0, 1.0);
+  ConsoleCommandShortcut(Orxonox, setTimeFactor, AccessLevel::Offline).setDefaultValue(0, 1.0);
+  ConsoleCommandShortcut(Orxonox, activateConsole, AccessLevel::None);
   class Testconsole : public InputBufferListener
   {
@@ -118,5 +118,5 @@
       void exit() const
       {
-        CommandExecutor::execute("setInputMode 2");
+        InputManager::setInputState(InputManager::IS_NORMAL);
       }
 
@@ -177,5 +177,5 @@
       delete this->orxonoxHUD_;
     Loader::close();
-    InputManager::getSingleton().destroy();
+    InputManager::destroy();
     if (this->auMan_)
       delete this->auMan_;
@@ -392,9 +392,8 @@
   void Orxonox::setupInputSystem()
   {
-    inputHandler_ = &InputManager::getSingleton();
-    if (!inputHandler_->initialise(ogre_->getWindowHandle(),
+    if (!InputManager::initialise(ogre_->getWindowHandle(),
           ogre_->getWindowWidth(), ogre_->getWindowHeight()))
       abortImmediateForce();
-    inputHandler_->setInputMode(IM_INGAME);
+    InputManager::setInputState(InputManager::IS_NORMAL);
   }
 
@@ -415,14 +414,13 @@
   void Orxonox::startRenderLoop()
   {
-    InputBuffer* ib = new InputBuffer();
-    InputManager::getSingleton().feedInputBuffer(ib);
-    Testconsole* console = new Testconsole(ib);
-    ib->registerListener(console, &Testconsole::listen, true);
-    ib->registerListener(console, &Testconsole::execute, '\r', false);
-    ib->registerListener(console, &Testconsole::execute, '\n', false);
-    ib->registerListener(console, &Testconsole::hintandcomplete, '\t', true);
-    ib->registerListener(console, &Testconsole::clear, '§', true);
-    ib->registerListener(console, &Testconsole::removeLast, '\b', true);
-    ib->registerListener(console, &Testconsole::exit, (char)0x1B, true);
+    InputBuffer* ib = dynamic_cast<InputBuffer*>(InputManager::getKeyListener("buffer"));
+    console_ = new Testconsole(ib);
+    ib->registerListener(console_, &Testconsole::listen, true);
+    ib->registerListener(console_, &Testconsole::execute, '\r', false);
+    ib->registerListener(console_, &Testconsole::execute, '\n', false);
+    ib->registerListener(console_, &Testconsole::hintandcomplete, '\t', true);
+    ib->registerListener(console_, &Testconsole::clear, '§', true);
+    ib->registerListener(console_, &Testconsole::removeLast, '\b', true);
+    ib->registerListener(console_, &Testconsole::exit, (char)0x1B, true);
 
     // first check whether ogre root object has been created
@@ -442,5 +440,5 @@
       eventTimes[i].clear();
     // fill the fps time list with zeros
-    for (int i = 0; i < 20; i++)
+    for (int i = 0; i < 50; i++)
       eventTimes[3].push_back(0);
 
@@ -468,6 +466,7 @@
       // show the current time in the HUD
       orxonoxHUD_->setTime((int)now, 0);
+      orxonoxHUD_->setRocket2(ogreRoot.getCurrentFrameNumber());
       if (eventTimes[3].back() - eventTimes[3].front() != 0)
-        orxonoxHUD_->setRocket1((int)(20000.0f/(eventTimes[3].back() - eventTimes[3].front())));
+        orxonoxHUD_->setRocket1((int)(50000.0f/(eventTimes[3].back() - eventTimes[3].front())));
 
       // Iterate through all Tickables and call their tick(dt) function
@@ -533,12 +532,7 @@
   }
 
-  /**
-    @brief Test method for the InputHandler.
-    But: Is actually responsible for catching an exit event..
-  */
-  void Orxonox::eventOccured(InputEvent &evt)
-  {
-    if (evt.id == 1)
-      this->abortRequest();
+  void Orxonox::activateConsole()
+  {
+    InputManager::setInputState(InputManager::IS_CONSOLE);
   }
 }
Index: /code/branches/input/src/orxonox/Orxonox.h
===================================================================
--- /code/branches/input/src/orxonox/Orxonox.h	(revision 1181)
+++ /code/branches/input/src/orxonox/Orxonox.h	(revision 1182)
@@ -49,4 +49,6 @@
 namespace orxonox {
 
+  class Testconsole;
+
   enum gameMode{
     SERVER,
@@ -56,5 +58,5 @@
 
   //! Orxonox singleton class
-  class _OrxonoxExport Orxonox : public InputEventListener
+  class _OrxonoxExport Orxonox
   {
     public:
@@ -72,4 +74,5 @@
       static inline float getTimeFactor() { return Orxonox::getSingleton()->timefactor_; }
       static inline void exit() { Orxonox::getSingleton()->abortRequest(); }
+      static inline void activateConsole();
 
    private:
@@ -95,6 +98,4 @@
       float calculateEventTime(unsigned long, std::deque<unsigned long>&);
 
-      void eventOccured(InputEvent &evt);
-
     private:
       GraphicsEngine*       ogre_;          //!< our dearest graphics engine <3
@@ -102,4 +103,5 @@
       audio::AudioManager*  auMan_;         //!< audio manager
       InputManager*         inputHandler_;  //!< Handles input with key bindings
+      Testconsole*          console_;
       Ogre::Timer*          timer_;         //!< Main loop timer
       // TODO: make this a config-value by creating a config class for orxonox
Index: /code/branches/input/src/orxonox/objects/SpaceShip.cc
===================================================================
--- /code/branches/input/src/orxonox/objects/SpaceShip.cc	(revision 1181)
+++ /code/branches/input/src/orxonox/objects/SpaceShip.cc	(revision 1182)
@@ -428,9 +428,9 @@
     void SpaceShip::tick(float dt)
     {
-      if (InputManager::getSingleton().getMouse()->getEventCallback() != this)
-        {
-            if (InputManager::getSingleton().getMouse())
+      if (InputManager::getMouse()->getEventCallback() != this)
+        {
+            if (InputManager::getMouse())
             {
-                InputManager::getSingleton().getMouse()->setEventCallback(this);
+                InputManager::getMouse()->setEventCallback(this);
                 this->setMouseEventCallback_ = true;
             }
@@ -457,5 +457,5 @@
         }
 
-        OIS::Keyboard* mKeyboard = InputManager::getSingleton().getKeyboard();
+        OIS::Keyboard* mKeyboard = InputManager::getKeyboard();
         //FIXME: variable never used
         //OIS::Mouse* mMouse = InputManager::getSingleton().getMouse();
Index: de/branches/input/visual_studio/loader_properties.vsprops
===================================================================
--- /code/branches/input/visual_studio/loader_properties.vsprops	(revision 1181)
+++ 	(revision )
@@ -1,17 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="loader_properties"
-	InheritedPropertySheets=".\directory_properties.vsprops"
-	>
-	<Tool
-		Name="VCCLCompilerTool"
-		PreprocessorDefinitions="LOADER_SHARED_BUILD"
-	/>
-	<Tool
-		Name="VCLinkerTool"
-		AdditionalDependencies="OgreMain$(CS).lib"
-		AdditionalLibraryDirectories="$(OutDir)"
-	/>
-</VisualStudioPropertySheet>
Index: /code/branches/input/visual_studio/vc8/core.vcproj
===================================================================
--- /code/branches/input/visual_studio/vc8/core.vcproj	(revision 1181)
+++ /code/branches/input/visual_studio/vc8/core.vcproj	(revision 1182)
@@ -203,4 +203,20 @@
 				RelativePath="..\..\src\core\InputHandler.cc"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
Index: /code/branches/input/visual_studio/vc8/orxonox.vcproj
===================================================================
--- /code/branches/input/visual_studio/vc8/orxonox.vcproj	(revision 1181)
+++ /code/branches/input/visual_studio/vc8/orxonox.vcproj	(revision 1182)
@@ -398,4 +398,12 @@
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
