Index: code/branches/network/bin/def_keybindings.ini
===================================================================
--- code/branches/network/bin/def_keybindings.ini	(revision 1413)
+++ code/branches/network/bin/def_keybindings.ini	(revision 1413)
@@ -0,0 +1,264 @@
+[KeyBinder]
+KeyUNASSIGNED=activateConsole
+KeyESCAPE=exit
+Key1=
+Key2=
+Key3=
+Key4=
+Key5=
+Key6=
+Key7=
+Key8=
+Key9=
+Key0=
+KeyMINUS=
+KeyEQUALS=activateConsole
+KeyBACK=
+KeyTAB=cycleNavigationFocus
+KeyQ=moveRoll
+KeyW=moveLongitudinal
+KeyE=scale -1 moveRoll
+KeyR=
+KeyT=
+KeyY=
+KeyU=
+KeyI=
+KeyO=
+KeyP=
+KeyLBRACKET=
+KeyRBRACKET=
+KeyRETURN=
+KeyLCONTROL=
+KeyA=scale -1 moveLateral
+KeyS=scale -1 moveLongitudinal
+KeyD=moveLateral
+KeyF=
+KeyG=
+KeyH=scale -0.3 moveYaw
+KeyJ=scale -0.3 movePitch
+KeyK=scale  0.3 movePitch
+KeyL=scale  0.3 moveYaw
+KeySEMICOLON=
+KeyAPOSTROPHE=
+KeyGRAVE=activateConsole
+KeyLSHIFT=
+KeyBACKSLASH=
+KeyZ=
+KeyX=
+KeyC=
+KeyV=
+KeyB=
+KeyN=
+KeyM=
+KeyCOMMA=
+KeyPERIOD=
+KeySLASH=
+KeyRSHIFT=
+KeyMULTIPLY=
+KeyLMENU=
+KeySPACE=
+KeyCAPITAL=
+KeyF1=
+KeyF2=
+KeyF3=
+KeyF4=
+KeyF5=
+KeyF6=
+KeyF7=
+KeyF8=
+KeyF9=
+KeyF10=
+KeyNUMLOCK=
+KeySCROLL=
+KeyNUMPAD7=
+KeyNUMPAD8=
+KeyNUMPAD9=
+KeySUBTRACT=
+KeyNUMPAD4=
+KeyNUMPAD5=
+KeyNUMPAD6=
+KeyADD=
+KeyNUMPAD1=
+KeyNUMPAD2=
+KeyNUMPAD3=
+KeyNUMPAD0=
+KeyDECIMAL=
+Key=
+KeyOEM_102=
+KeyF11=
+KeyF12=
+KeyF13=
+KeyF14=
+KeyF15=
+KeyKANA=
+KeyABNT_C1=
+KeyCONVERT=
+KeyNOCONVERT=
+KeyYEN=
+KeyABNT_C2=
+KeyNUMPADEQUALS=
+KeyPREVTRACK=
+KeyAT=
+KeyCOLON=
+KeyUNDERLINE=
+KeyKANJI=
+KeySTOP=
+KeyAX=
+KeyUNLABELED=
+KeyNEXTTRACK=
+KeyNUMPADENTER=activateConsole
+KeyRCONTROL=
+KeyMUTE=
+KeyCALCULATOR=
+KeyPLAYPAUSE=
+KeyMEDIASTOP=
+KeyVOLUMEDOWN=
+KeyVOLUMEUP=
+KeyWEBHOME=
+KeyNUMPADCOMMA=
+KeyDIVIDE=
+KeySYSRQ=
+KeyRMENU=
+KeyPAUSE=
+KeyHOME=
+KeyUP=
+KeyPGUP=
+KeyLEFT=
+KeyRIGHT=
+KeyEND=
+KeyDOWN=
+KeyPGDOWN=
+KeyINSERT=
+KeyDELETE=
+KeyLWIN=
+KeyRWIN=
+KeyAPPS=
+KeyPOWER=
+KeySLEEP=
+KeyWAKE=
+KeyWEBSEARCH=
+KeyWEBFAVORITES=
+KeyWEBREFRESH=
+KeyWEBSTOP=exit
+KeyWEBFORWARD=
+KeyWEBBACK=
+KeyMYCOMPUTER=
+KeyMAIL=
+KeyMEDIASELECT=
+MouseLeft=fire
+MouseRight=
+MouseMiddle=
+MouseButton3=
+MouseButton4=
+MouseButton5=
+MouseButton6=
+MouseButton7=
+MouseWheel1Up=
+MouseWheel1Down=
+MouseWheel2Up=
+MouseWheel2Down=
+MouseXPos=scale  1 moveYaw
+MouseXNeg=scale -1 moveYaw
+MouseYPos=scale  1 movePitch
+MouseYNeg=scale -1 movePitch
+Empty1Pos=
+Empty1Neg=
+Empty2Pos=
+Empty2Neg=
+JoyAxis1Pos=scale -1 movePitch
+JoyAxis1Neg=scale  1 movePitch
+JoyAxis2Pos=
+JoyAxis2Neg=
+JoyAxis3Pos=
+JoyAxis3Neg=
+JoyAxis4Pos=
+JoyAxis4Neg=
+JoyAxis5Pos=
+JoyAxis5Neg=
+JoyAxis6Pos=
+JoyAxis6Neg=
+JoyAxis7Pos=
+JoyAxis7Neg=
+JoyAxis8Pos=
+JoyAxis8Neg=
+JoyAxis9Pos=scale   1 moveYaw
+JoyAxis9Neg=scale  -1 moveYaw
+JoyAxis10Pos=
+JoyAxis10Neg=
+JoyAxis11Pos=scale -1 moveLongitudinal
+JoyAxis11Neg=scale  1 moveLongitudinal
+JoyAxis12Pos=scale  1 moveLateral
+JoyAxis12Neg=scale -1 moveLateral
+JoyAxis13Pos=
+JoyAxis13Neg=
+JoyAxis14Pos=
+JoyAxis14Neg=
+JoyAxis15Pos=
+JoyAxis15Neg=
+JoyAxis16Pos=
+JoyAxis16Neg=
+JoyAxis17Pos=
+JoyAxis17Neg=
+JoyAxis18Pos=
+JoyAxis18Neg=
+JoyAxis19Pos=
+JoyAxis19Neg=
+JoyAxis20Pos=
+JoyAxis20Neg=
+JoyAxis21Pos=
+JoyAxis21Neg=
+JoyAxis22Pos=
+JoyAxis22Neg=
+JoyAxis23Pos=
+JoyAxis23Neg=
+JoyAxis24Pos=
+JoyAxis24Neg=
+JoyButton0=cycleNavigationFocus
+JoyButton1=
+JoyButton2=
+JoyButton3=
+JoyButton4=
+JoyButton5=
+JoyButton6=scale  1 moveRoll
+JoyButton7=scale -1 moveRoll
+JoyButton8=
+JoyButton9=fire
+JoyButton10=
+JoyButton11=
+JoyButton12=
+JoyButton13=
+JoyButton14=
+JoyButton15=
+JoyButton16=
+JoyButton17=
+JoyButton18=
+JoyButton19=
+JoyButton20=
+JoyButton21=
+JoyButton22=
+JoyButton23=
+JoyButton24=
+JoyButton25=
+JoyButton26=
+JoyButton27=
+JoyButton28=
+JoyButton29=
+JoyButton30=
+JoyButton31=
+JoyPOV1North=
+JoyPOV1South=
+JoyPOV1East=
+JoyPOV1West=
+JoyPOV2North=
+JoyPOV2South=
+JoyPOV2East=
+JoyPOV2West=
+JoyPOV3North=
+JoyPOV3South=
+JoyPOV3East=
+JoyPOV3West=
+JoyPOV4North=
+JoyPOV4South=
+JoyPOV4East=
+JoyPOV4West=
+
Index: code/branches/network/bin/keybindings.ini
===================================================================
--- code/branches/network/bin/keybindings.ini	(revision 1412)
+++ 	(revision )
@@ -1,264 +1,0 @@
-[KeyBinder]
-KeyUNASSIGNED=activateConsole
-KeyESCAPE=exit
-Key1=
-Key2=
-Key3=
-Key4=
-Key5=
-Key6=
-Key7=
-Key8=
-Key9=
-Key0=
-KeyMINUS=
-KeyEQUALS=activateConsole
-KeyBACK=
-KeyTAB=cycleNavigationFocus
-KeyQ=moveRoll
-KeyW=moveLongitudinal
-KeyE=scale -1 moveRoll
-KeyR=
-KeyT=
-KeyY=
-KeyU=
-KeyI=
-KeyO=
-KeyP=
-KeyLBRACKET=
-KeyRBRACKET=
-KeyRETURN=
-KeyLCONTROL=
-KeyA=scale -1 moveLateral
-KeyS=scale -1 moveLongitudinal
-KeyD=moveLateral
-KeyF=
-KeyG=
-KeyH=scale -0.3 moveYaw
-KeyJ=scale -0.3 movePitch
-KeyK=scale  0.3 movePitch
-KeyL=scale  0.3 moveYaw
-KeySEMICOLON=
-KeyAPOSTROPHE=
-KeyGRAVE=activateConsole
-KeyLSHIFT=
-KeyBACKSLASH=
-KeyZ=
-KeyX=
-KeyC=
-KeyV=
-KeyB=
-KeyN=
-KeyM=
-KeyCOMMA=
-KeyPERIOD=
-KeySLASH=
-KeyRSHIFT=
-KeyMULTIPLY=
-KeyLMENU=
-KeySPACE=
-KeyCAPITAL=
-KeyF1=
-KeyF2=
-KeyF3=
-KeyF4=
-KeyF5=
-KeyF6=
-KeyF7=
-KeyF8=
-KeyF9=
-KeyF10=
-KeyNUMLOCK=
-KeySCROLL=
-KeyNUMPAD7=
-KeyNUMPAD8=
-KeyNUMPAD9=
-KeySUBTRACT=
-KeyNUMPAD4=
-KeyNUMPAD5=
-KeyNUMPAD6=
-KeyADD=
-KeyNUMPAD1=
-KeyNUMPAD2=
-KeyNUMPAD3=
-KeyNUMPAD0=
-KeyDECIMAL=
-Key=
-KeyOEM_102=
-KeyF11=
-KeyF12=
-KeyF13=
-KeyF14=
-KeyF15=
-KeyKANA=
-KeyABNT_C1=
-KeyCONVERT=
-KeyNOCONVERT=
-KeyYEN=
-KeyABNT_C2=
-KeyNUMPADEQUALS=
-KeyPREVTRACK=
-KeyAT=
-KeyCOLON=
-KeyUNDERLINE=
-KeyKANJI=
-KeySTOP=
-KeyAX=
-KeyUNLABELED=
-KeyNEXTTRACK=
-KeyNUMPADENTER=activateConsole
-KeyRCONTROL=
-KeyMUTE=
-KeyCALCULATOR=
-KeyPLAYPAUSE=
-KeyMEDIASTOP=
-KeyVOLUMEDOWN=
-KeyVOLUMEUP=
-KeyWEBHOME=
-KeyNUMPADCOMMA=
-KeyDIVIDE=
-KeySYSRQ=
-KeyRMENU=
-KeyPAUSE=
-KeyHOME=
-KeyUP=
-KeyPGUP=
-KeyLEFT=
-KeyRIGHT=
-KeyEND=
-KeyDOWN=
-KeyPGDOWN=
-KeyINSERT=
-KeyDELETE=
-KeyLWIN=
-KeyRWIN=
-KeyAPPS=
-KeyPOWER=
-KeySLEEP=
-KeyWAKE=
-KeyWEBSEARCH=
-KeyWEBFAVORITES=
-KeyWEBREFRESH=
-KeyWEBSTOP=exit
-KeyWEBFORWARD=
-KeyWEBBACK=
-KeyMYCOMPUTER=
-KeyMAIL=
-KeyMEDIASELECT=
-MouseLeft=fire
-MouseRight=
-MouseMiddle=
-MouseButton3=
-MouseButton4=
-MouseButton5=
-MouseButton6=
-MouseButton7=
-MouseWheel1Up=
-MouseWheel1Down=
-MouseWheel2Up=
-MouseWheel2Down=
-MouseXPos=scale  1 moveYaw
-MouseXNeg=scale -1 moveYaw
-MouseYPos=scale  1 movePitch
-MouseYNeg=scale -1 movePitch
-Empty1Pos=
-Empty1Neg=
-Empty2Pos=
-Empty2Neg=
-JoyAxis1Pos=scale -1 movePitch
-JoyAxis1Neg=scale  1 movePitch
-JoyAxis2Pos=
-JoyAxis2Neg=
-JoyAxis3Pos=
-JoyAxis3Neg=
-JoyAxis4Pos=
-JoyAxis4Neg=
-JoyAxis5Pos=
-JoyAxis5Neg=
-JoyAxis6Pos=
-JoyAxis6Neg=
-JoyAxis7Pos=
-JoyAxis7Neg=
-JoyAxis8Pos=
-JoyAxis8Neg=
-JoyAxis9Pos=scale   1 moveYaw
-JoyAxis9Neg=scale  -1 moveYaw
-JoyAxis10Pos=
-JoyAxis10Neg=
-JoyAxis11Pos=scale -1 moveLongitudinal
-JoyAxis11Neg=scale  1 moveLongitudinal
-JoyAxis12Pos=scale  1 moveLateral
-JoyAxis12Neg=scale -1 moveLateral
-JoyAxis13Pos=
-JoyAxis13Neg=
-JoyAxis14Pos=
-JoyAxis14Neg=
-JoyAxis15Pos=
-JoyAxis15Neg=
-JoyAxis16Pos=
-JoyAxis16Neg=
-JoyAxis17Pos=
-JoyAxis17Neg=
-JoyAxis18Pos=
-JoyAxis18Neg=
-JoyAxis19Pos=
-JoyAxis19Neg=
-JoyAxis20Pos=
-JoyAxis20Neg=
-JoyAxis21Pos=
-JoyAxis21Neg=
-JoyAxis22Pos=
-JoyAxis22Neg=
-JoyAxis23Pos=
-JoyAxis23Neg=
-JoyAxis24Pos=
-JoyAxis24Neg=
-JoyButton0=cycleNavigationFocus
-JoyButton1=
-JoyButton2=
-JoyButton3=
-JoyButton4=
-JoyButton5=
-JoyButton6=scale  1 moveRoll
-JoyButton7=scale -1 moveRoll
-JoyButton8=
-JoyButton9=fire
-JoyButton10=
-JoyButton11=
-JoyButton12=
-JoyButton13=
-JoyButton14=
-JoyButton15=
-JoyButton16=
-JoyButton17=
-JoyButton18=
-JoyButton19=
-JoyButton20=
-JoyButton21=
-JoyButton22=
-JoyButton23=
-JoyButton24=
-JoyButton25=
-JoyButton26=
-JoyButton27=
-JoyButton28=
-JoyButton29=
-JoyButton30=
-JoyButton31=
-JoyPOV1North=
-JoyPOV1South=
-JoyPOV1East=
-JoyPOV1West=
-JoyPOV2North=
-JoyPOV2South=
-JoyPOV2East=
-JoyPOV2West=
-JoyPOV3North=
-JoyPOV3South=
-JoyPOV3East=
-JoyPOV3West=
-JoyPOV4North=
-JoyPOV4South=
-JoyPOV4East=
-JoyPOV4West=
-
Index: code/branches/network/src/core/CMakeLists.txt
===================================================================
--- code/branches/network/src/core/CMakeLists.txt	(revision 1412)
+++ code/branches/network/src/core/CMakeLists.txt	(revision 1413)
@@ -12,6 +12,6 @@
   IdentifierDistributor.cc
   InputBuffer.cc
-  InputHandler.cc
   InputManager.cc
+  KeyBinder.cc
   Language.cc
   Loader.cc
Index: code/branches/network/src/core/ConfigFileManager.cc
===================================================================
--- code/branches/network/src/core/ConfigFileManager.cc	(revision 1412)
+++ code/branches/network/src/core/ConfigFileManager.cc	(revision 1413)
@@ -336,4 +336,12 @@
 
         COUT(4) << "Saved config file \"" << this->filename_ << "\"." << std::endl;
+    }
+
+    void ConfigFile::save(const std::string& filename)
+    {
+        std::string temp = this->filename_;
+        this->filename_ = filename;
+        this->save();
+        this->filename_ = temp;
     }
 
@@ -473,4 +481,9 @@
     }
 
+    void ConfigFileManager::save(ConfigFileType type, const std::string& filename)
+    {
+        this->getFile(type)->save(filename);
+    }
+
     void ConfigFileManager::clean(ConfigFileType type, bool bCleanComments)
     {
Index: code/branches/network/src/core/ConfigFileManager.h
===================================================================
--- code/branches/network/src/core/ConfigFileManager.h	(revision 1412)
+++ code/branches/network/src/core/ConfigFileManager.h	(revision 1413)
@@ -222,4 +222,5 @@
             void load(bool bCreateIfNotExisting = true);
             void save() const;
+            void save(const std::string& filename);
             void clean(bool bCleanComments = false);
 
@@ -265,4 +266,5 @@
             void load(ConfigFileType type, bool bCreateIfNotExisting = true);
             void save(ConfigFileType type);
+            void save(ConfigFileType type, const std::string& filename);
             void clean(ConfigFileType type, bool bCleanComments = false);
 
Index: code/branches/network/src/core/CorePrereqs.h
===================================================================
--- code/branches/network/src/core/CorePrereqs.h	(revision 1412)
+++ code/branches/network/src/core/CorePrereqs.h	(revision 1413)
@@ -161,5 +161,5 @@
   class JoyStickHandler;
   class KeyBinder;
-  class KeyHandler;
+  class KeyDetector;
   class MouseHandler;
 
Index: code/branches/network/src/core/InputBuffer.cc
===================================================================
--- code/branches/network/src/core/InputBuffer.cc	(revision 1412)
+++ code/branches/network/src/core/InputBuffer.cc	(revision 1413)
@@ -177,5 +177,5 @@
   * @param dt Delta time
   */
-  void InputBuffer::tick(float dt)
+  void InputBuffer::tickInput(float dt, const HandlerState& state)
   {
     timeSinceKeyPressed_ += dt;
Index: code/branches/network/src/core/InputBuffer.h
===================================================================
--- code/branches/network/src/core/InputBuffer.h	(revision 1412)
+++ code/branches/network/src/core/InputBuffer.h	(revision 1413)
@@ -106,5 +106,5 @@
     void processKey (const KeyEvent &e);
 
-    void tick(float dt);
+    void tickInput(float dt, const HandlerState& state);
 
   private: // variables
Index: code/branches/network/src/core/InputHandler.cc
===================================================================
--- code/branches/network/src/core/InputHandler.cc	(revision 1412)
+++ 	(revision )
@@ -1,856 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-/**
- @file
- @brief Implementation of the different input handlers.
- */
-
-#include "InputHandler.h"
-#include <fstream>
-#include "util/Convert.h"
-#include "util/SubString.h"
-#include "util/String.h"
-#include "Debug.h"
-#include "ConfigValueIncludes.h"
-#include "CoreIncludes.h"
-#include "CommandExecutor.h"
-#include "Executor.h"
-
-namespace orxonox
-{
-  // ###############################
-  // ######      Button       ######
-  // ###############################
-
-  bool BufferedParamCommand::execute()
-  {
-    if (nValuesAdded_)
-    {
-      BufferedParamCommand& cmd = *this;
-      cmd.evaluation_.setEvaluatedParameter(cmd.paramIndex_, cmd.value_);
-      // reset
-      cmd.nValuesAdded_ = 0;
-      cmd.value_ = 0;
-      return CommandExecutor::execute(cmd.evaluation_);
-    }
-    else
-      return true;
-  }
-
-  bool SimpleCommand::execute(float abs, float rel)
-  {
-    return CommandExecutor::execute(evaluation_);
-  }
-
-  bool ParamCommand::execute(float abs, float rel)
-  {
-    BufferedParamCommand& paramCommand = *paramCommand_;
-    // command has an additional parameter
-    if (bRelative_ && (rel > 0 || rel < 0))
-    {
-      // we have to calculate a relative movement.
-      // paramModifier_ says how much one keystroke is
-      paramCommand.value_ += paramModifier_ * rel;
-    }
-    else if (abs > 0 || abs < 0)
-    {
-      // we have to calculate absolute position of the axis.
-      // Since there might be another axis that is affected, we have to wait and
-      // store the result in a temporary place
-      paramCommand.value_ = (paramCommand.value_ * paramCommand.nValuesAdded_ + paramModifier_ * abs)
-                            /++paramCommand.nValuesAdded_;
-    }
-    return true;
-  }
-
-  void Button::clear()
-  {
-    for (unsigned int j = 0; j < 3; j++)
-    {
-      if (nCommands_[j])
-      {
-        // delete all commands and the command pointer array
-        for (unsigned int i = 0; i < nCommands_[j]; i++)
-          delete commands_[j][i];
-        delete[] commands_[j];
-        commands_[j] = 0;
-        nCommands_[j] = 0;
-      }
-      else
-      {
-        commands_[j] = 0;
-      }
-    }
-  }
-
-  void Button::parse(std::vector<BufferedParamCommand*>& paramCommandBuffer)
-  {
-    if (isEmpty(bindingString_))
-    {
-      clear();
-      return;
-    }
-
-    // use std::vector for a temporary dynamic array
-    std::vector<BaseCommand*> commands[3];
-
-
-    // separate the commands
-    SubString commandStrings(bindingString_, "|", SubString::WhiteSpaces, false,
-        '\\', false, '"', false, '(', ')', false, '\0');
-
-    for (unsigned int iCommand = 0; iCommand < commandStrings.size(); iCommand++)
-    {
-      if (commandStrings[iCommand] != "")
-      {
-        SubString tokens(commandStrings[iCommand], " ", SubString::WhiteSpaces, false,
-            '\\', false, '"', false, '(', ')', false, '\0');
-        
-        unsigned int iToken = 0;
-
-        // for real axes, we can feed a ButtonThreshold argument as entire command
-        if (getLowercase(tokens[0]) == "buttonthreshold")
-        {
-          if (tokens.size() == 1)
-            continue;
-          // may fail, but doesn't matter
-          convertValue(&buttonThreshold_, tokens[1]);
-          continue;
-        }
-
-        // first argument can be OnPress, OnHold OnRelease or nothing
-        KeybindMode::Enum mode = KeybindMode::None;
-        if (getLowercase(tokens[iToken]) == "onpress")
-          mode = KeybindMode::OnPress,   iToken++;
-        if (getLowercase(tokens[iToken]) == "onrelease")
-          mode = KeybindMode::OnRelease, iToken++;
-        if (getLowercase(tokens[iToken]) == "onhold")
-          mode = KeybindMode::OnHold,    iToken++;
-
-        if (iToken == tokens.size())
-          continue;
-
-        // second argument can be the amplitude for the case it as an axis command
-        // default amplitude is 1.0f
-        float paramModifier = 1.0f;
-        if (getLowercase(tokens[iToken]) == "scale")
-        {
-          iToken++;
-          if (iToken == tokens.size() || !convertValue(&paramModifier, tokens[iToken]))
-          {
-            COUT(2) << "Error while parsing key binding " << name_
-                << ". Numeric expression expected afer 'AxisAmp', switching to default value" << std::endl;
-            if (iToken == tokens.size())
-              continue;
-          }
-          iToken++;
-        }
-
-        // no more arguments expected except for the actual command
-        if (iToken == tokens.size())
-          continue;
-
-        std::string commandStr;
-        while (iToken != tokens.size())
-          commandStr += tokens[iToken++] + " ";
-
-        // evaluate the command
-        CommandEvaluation eval = CommandExecutor::evaluate(commandStr);
-        if (!eval.isValid())
-          continue;
-
-        // check for param command
-        int paramIndex = eval.getEvaluatedExecutor()->getAxisParamIndex();
-        // TODO: check in Executor for correct paramIndex
-        if (paramIndex >= 0)
-        {
-          // parameter supported command
-          ParamCommand* cmd = new ParamCommand();
-          cmd->paramModifier_ = paramModifier;
-          cmd->bRelative_ = eval.getEvaluatedExecutor()->getIsAxisRelative();
-
-          // add command to the buffer if not yet existing
-          for (unsigned int iParamCmd = 0; iParamCmd < paramCommandBuffer.size(); iParamCmd++)
-          {
-            if (getLowercase(paramCommandBuffer[iParamCmd]->evaluation_.getCommandString())
-                == getLowercase(commandStr))
-            {
-              // already in list
-              cmd->paramCommand_ = paramCommandBuffer[iParamCmd];
-              break;
-            }
-          }
-          if (cmd->paramCommand_ == 0)
-          {
-            cmd->paramCommand_ = new BufferedParamCommand();
-            paramCommandBuffer.push_back(cmd->paramCommand_);
-            cmd->paramCommand_->evaluation_ = eval;
-            cmd->paramCommand_->paramIndex_ = paramIndex;
-          }
-
-
-          // we don't know whether this is an actual axis or just a button
-          if (mode == KeybindMode::None)
-          {
-            if (!addParamCommand(cmd))
-            {
-              mode = eval.getEvaluatedExecutor()->getKeybindMode();
-              commands[mode].push_back(cmd);
-            }
-          }
-        }
-        else
-        {
-          SimpleCommand* cmd = new SimpleCommand();
-          cmd->evaluation_ = eval;
-
-          //TODO: check CommandEvaluation for correct KeybindMode
-          if (mode == KeybindMode::None)
-            mode = eval.getEvaluatedExecutor()->getKeybindMode();
-
-          commands[mode].push_back(cmd);
-        }
-      }
-    }
-
-    for (unsigned int j = 0; j < 3; j++)
-    {
-      nCommands_[j] = commands[j].size();
-      if (nCommands_[j])
-      {
-        commands_[j] = new BaseCommand*[nCommands_[j]];
-        for (unsigned int i = 0; i < commands[j].size(); i++)
-          commands_[j][i] = commands[j][i];
-      }
-      else
-        commands_[j] = 0;
-    }
-  }
-
-  bool Button::execute(KeybindMode::Enum mode, float abs, float rel)
-  {
-    // execute all the parsed commands in the string
-    for (unsigned int iCommand = 0; iCommand < nCommands_[mode]; iCommand++)
-      commands_[mode][iCommand]->execute(abs, rel);
-    return true;
-  }
-
-  void HalfAxis::clear()
-  {
-    Button::clear();
-    if (nParamCommands_)
-    {
-      // delete all commands and the command pointer array
-      for (unsigned int i = 0; i < nParamCommands_; i++)
-        delete paramCommands_[i];
-      delete[] paramCommands_;
-    }
-    else
-    {
-      nParamCommands_ = 0; nParamCommands_ = 0;
-    }
-  }
-  
-  bool HalfAxis::addParamCommand(ParamCommand* command)
-  {
-    ParamCommand** cmds = paramCommands_;
-    paramCommands_ = new ParamCommand*[++nParamCommands_];
-    unsigned int i;
-    for (i = 0; i < nParamCommands_ - 1; i++)
-      paramCommands_[i] = cmds[i];
-    paramCommands_[i] = command;
-    delete[] cmds;
-    return true;
-  }
-
-  bool HalfAxis::execute()
-  {
-    bool success = true;
-    for (unsigned int i = 0; i < nParamCommands_; i++)
-      success = success && paramCommands_[i]->execute(absVal_, relVal_);
-    return success;
-  }
-
-
-  // ###############################
-  // ######     KeyBinder     ######
-  // ###############################
-
-  /**
-    @brief Constructor that does as little as necessary.
-  */
-  KeyBinder::KeyBinder() : deriveTime_(0.0f)
-  {
-    mouseRelative_[0] = 0;
-    mouseRelative_[1] = 0;
-    mousePosition_[0] = 0;
-    mousePosition_[1] = 0;
-
-    RegisterObject(KeyBinder);
-
-    // keys
-    std::string keyNames[] = {
-      "UNASSIGNED",
-      "ESCAPE",
-      "1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
-      "MINUS", "EQUALS", "BACK", "TAB",
-      "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P",
-      "LBRACKET", "RBRACKET",
-      "RETURN", "LCONTROL",
-      "A", "S", "D", "F", "G", "H", "J", "K", "L",
-      "SEMICOLON", "APOSTROPHE", "GRAVE",
-      "LSHIFT", "BACKSLASH",
-      "Z", "X", "C", "V", "B", "N", "M",
-      "COMMA", "PERIOD", "SLASH",
-      "RSHIFT",
-      "MULTIPLY",
-      "LMENU",
-      "SPACE",
-      "CAPITAL",
-      "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10",
-      "NUMLOCK", "SCROLL",
-      "NUMPAD7", "NUMPAD8", "NUMPAD9",
-      "SUBTRACT",
-      "NUMPAD4", "NUMPAD5", "NUMPAD6",
-      "ADD",
-      "NUMPAD1", "NUMPAD2", "NUMPAD3", "NUMPAD0",
-      "DECIMAL",
-      "","",
-      "OEM_102",
-      "F11", "F12",
-      "","","","","","","","","","","",
-      "F13", "F14", "F15",
-      "","","","","","","","","","",
-      "KANA",
-      "","",
-      "ABNT_C1",
-      "","","","","",
-      "CONVERT",
-      "",
-      "NOCONVERT",
-      "",
-      "YEN",
-      "ABNT_C2",
-      "","","","","","","","","","","","","","",
-      "NUMPADEQUALS",
-      "","",
-      "PREVTRACK",
-      "AT",
-      "COLON", "UNDERLINE",
-      "KANJI",
-      "STOP",
-      "AX",
-      "UNLABELED",
-      "NEXTTRACK",
-      "","",
-      "NUMPADENTER",
-      "RCONTROL",
-      "","",
-      "MUTE",
-      "CALCULATOR",
-      "PLAYPAUSE",
-      "",
-      "MEDIASTOP",
-      "","","","","","","","","",
-      "VOLUMEDOWN",
-      "",
-      "VOLUMEUP",
-      "",
-      "WEBHOME",
-      "NUMPADCOMMA",
-      "",
-      "DIVIDE",
-      "",
-      "SYSRQ",
-      "RMENU",
-      "","","","","","","","","","","","",
-      "PAUSE",
-      "",
-      "HOME",
-      "UP",
-      "PGUP",
-      "",
-      "LEFT",
-      "",
-      "RIGHT",
-      "",
-      "END", "DOWN", "PGDOWN", "INSERT", "DELETE",
-      "","","","","","","",
-      "LWIN", "RWIN", "APPS",
-      "POWER", "SLEEP",
-      "","","",
-      "WAKE",
-      "",
-      "WEBSEARCH", "WEBFAVORITES", "WEBREFRESH", "WEBSTOP", "WEBFORWARD", "WEBBACK",
-      "MYCOMPUTER", "MAIL", "MEDIASELECT"
-    };
-    for (unsigned int i = 0; i < nKeys_s; i++)
-      keys_[i].name_ = "Key" + keyNames[i];
-
-    // mouse buttons
-    std::string mouseButtonNames[] = {
-      "MouseLeft", "MouseRight", "MouseMiddle",
-      "MouseButton3", "MouseButton4", "MouseButton5",
-      "MouseButton6", "MouseButton7",
-      "MouseWheel1Up", "MouseWheel1Down",
-      "MouseWheel2Up", "MouseWheel2Down" };
-    for (unsigned int i = 0; i < nMouseButtons_s; i++)
-      mouseButtons_[i].name_ = mouseButtonNames[i];
-
-    // joy stick buttons
-    for (unsigned int i = 0; i < 32; i++)
-      joyStickButtons_[i].name_ = "JoyButton" + getConvertedValue<int, std::string>(i);
-    for (unsigned int i = 32; i < nJoyStickButtons_s; i += 4)
-    {
-		  joyStickButtons_[i + 0].name_ = "JoyPOV" + getConvertedValue<int, std::string>((i - 32)/4 + 1) + "North";
-		  joyStickButtons_[i + 1].name_ = "JoyPOV" + getConvertedValue<int, std::string>((i - 32)/4 + 1) + "South";
-		  joyStickButtons_[i + 2].name_ = "JoyPOV" + getConvertedValue<int, std::string>((i - 32)/4 + 1) + "East";
-		  joyStickButtons_[i + 3].name_ = "JoyPOV" + getConvertedValue<int, std::string>((i - 32)/4 + 1) + "West";
-    }
-
-    // half axes
-    std::string rawNames[nHalfAxes_s/2];
-    rawNames[0] = "MouseX";
-    rawNames[1] = "MouseY";
-    rawNames[2] = "Empty1";
-    rawNames[3] = "Empty2";
-    for (unsigned int i = 4; i < nHalfAxes_s/2; i++)
-      rawNames[i] = "JoyAxis" + getConvertedValue<int, std::string>(i - 3);
-    for (unsigned int i = 0; i < nHalfAxes_s/2; i++)
-    {
-      halfAxes_[i * 2 + 0].name_ = rawNames[i] + "Pos";
-      halfAxes_[i * 2 + 1].name_ = rawNames[i] + "Neg";
-    }
-
-    for (unsigned int i = 0; i < this->nHalfAxes_s; i++)
-      halfAxes_[i].buttonThreshold_ = buttonThreshold_;
-  }
-
-  /**
-    @brief Destructor
-  */
-  KeyBinder::~KeyBinder()
-  {
-    // almost no destructors required because most of the arrays are static.
-    clearBindings(); // does some destruction work
-  }
-
-  /**
-    @brief Loads the key and button bindings.
-    @return True if loading succeeded.
-  */
-  void KeyBinder::loadBindings()
-  {
-    COUT(3) << "KeyBinder: Loading key bindings..." << std::endl;
-
-    clearBindings();
-
-    /*std::ifstream infile;
-    infile.open("keybindings.ini");
-    if (!infile.is_open())
-    {
-      ConfigFileManager::getSingleton()->setFile(CFT_Keybindings, "keybindings_def.ini");
-      setConfigValues();
-    }
-    infile.close();*/
-    ConfigFileManager::getSingleton()->setFile(CFT_Keybindings, "keybindings.ini");
-    setConfigValues();
-
-    COUT(3) << "KeyBinder: Loading key bindings done." << std::endl;
-  }
-
-  /**
-    @brief Loader for the key bindings, managed by config values.
-  */
-  void KeyBinder::setConfigValues()
-  {
-    SetConfigValue(analogThreshold_, 0.01f)  .description("Threshold for analog axes until which the state is 0.");
-    SetConfigValue(mouseSensitivity_, 1.0f)  .description("Mouse sensitivity.");
-    SetConfigValue(bDeriveMouseInput_, false).description("Whether or not to derive moues movement for the absolute value.");
-    SetConfigValue(derivePeriod_, 0.1f).description("Accuracy of the mouse input deriver. The higher the more precise, but laggier.");
-    SetConfigValue(mouseSensitivityDerived_, 1.0f).description("Mouse sensitivity if mouse input is derived.");
-    SetConfigValue(keybindingsDefault_, "keybindings_def.ini").description("Default ini file for the keybindings.");
-
-    float oldThresh = buttonThreshold_;
-    SetConfigValue(buttonThreshold_, 0.80f).description("Threshold for analog axes until which the button is not pressed.");
-    if (oldThresh != buttonThreshold_)
-      for (unsigned int i = 0; i < nHalfAxes_s; i++)
-        if (halfAxes_[i].buttonThreshold_ == oldThresh)
-          halfAxes_[i].buttonThreshold_ = buttonThreshold_;
-
-    // keys
-    for (unsigned int i = 0; i < nKeys_s; i++)
-      readTrigger(keys_[i]);
-    // mouse buttons
-    for (unsigned int i = 0; i < nMouseButtons_s; i++)
-      readTrigger(mouseButtons_[i]);
-    // joy stick buttons
-    for (unsigned int i = 0; i < nJoyStickButtons_s; i++)
-      readTrigger(joyStickButtons_[i]);
-    // half axes
-    for (unsigned int i = 0; i < nHalfAxes_s; i++)
-      readTrigger(halfAxes_[i]);
-  }
-
-  void KeyBinder::readTrigger(Button& button)
-  {
-    // config value stuff
-    ConfigValueContainer* cont = getIdentifier()->getConfigValueContainer(button.name_);
-    if (!cont)
-    {
-      cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), button.name_, "");
-      getIdentifier()->addConfigValueContainer(button.name_, cont);
-    }
-    std::string old = button.bindingString_;
-    cont->getValue(&button.bindingString_);
-
-    // keybinder stuff
-    if (old != button.bindingString_)
-    {
-      // binding has changed
-      button.parse(paramCommandBuffer_);
-    }
-  }
-
-  /**
-    @brief Overwrites all bindings with ""
-  */
-  void KeyBinder::clearBindings(bool bInit)
-  {
-    for (unsigned int i = 0; i < nKeys_s; i++)
-      keys_[i].clear();
-
-    for (unsigned int i = 0; i < nMouseButtons_s; i++)
-      mouseButtons_[i].clear();
-
-    for (unsigned int i = 0; i < nJoyStickButtons_s; i++)
-      joyStickButtons_[i].clear();
-
-    for (unsigned int i = 0; i < nHalfAxes_s; i++)
-      halfAxes_[i].clear();
-
-    for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
-      delete paramCommandBuffer_[i];
-    paramCommandBuffer_.clear();
-  }
-
-  void KeyBinder::tick(float dt)
-  {
-    // we have to process all the analog input since there is e.g. no 'mouseDoesntMove' event.
-    for (unsigned int i = 0; i < nHalfAxes_s; i++)
-    {
-      if (halfAxes_[i].hasChanged_)
-      {
-        if (!halfAxes_[i].wasDown_ && halfAxes_[i].absVal_ > halfAxes_[i].buttonThreshold_)
-        {
-          halfAxes_[i].wasDown_ = true;
-          if (halfAxes_[i].nCommands_[KeybindMode::OnPress])
-            halfAxes_[i].execute(KeybindMode::OnPress);
-        }
-        else if (halfAxes_[i].wasDown_ && halfAxes_[i].absVal_ < halfAxes_[i].buttonThreshold_)
-        {
-          halfAxes_[i].wasDown_ = false;
-          if (halfAxes_[i].nCommands_[KeybindMode::OnRelease])
-            halfAxes_[i].execute(KeybindMode::OnRelease);
-        }
-        if (halfAxes_[i].wasDown_)
-        {
-          if (halfAxes_[i].nCommands_[KeybindMode::OnHold])
-            halfAxes_[i].execute(KeybindMode::OnHold);
-        }
-        halfAxes_[i].hasChanged_ = false;
-      }
-
-      // these are the actually useful axis bindings for analog input AND output
-      if (halfAxes_[i].relVal_ > analogThreshold_ || halfAxes_[i].absVal_ > analogThreshold_)
-      {
-        //COUT(3) << halfAxes_[i].name_ << "\t" << halfAxes_[i].absVal_ << std::endl;
-        halfAxes_[i].execute();
-      }
-    }
-
-    if (bDeriveMouseInput_)
-    {
-      if (deriveTime_ > derivePeriod_)
-      {
-        deriveTime_ = 0.0f;
-        //CCOUT(3) << "mouse abs: ";
-        for (int i = 0; i < 2; i++)
-        {
-          if (mouseRelative_[i] > 0)
-          {
-            halfAxes_[2*i + 0].absVal_ =  mouseRelative_[i] / derivePeriod_ / 5000 * mouseSensitivityDerived_;
-            halfAxes_[2*i + 1].absVal_ = 0.0f;
-          }
-          else if (mouseRelative_[i] < 0)
-          {
-            halfAxes_[2*i + 0].absVal_ = 0.0f;
-            halfAxes_[2*i + 1].absVal_ = -mouseRelative_[i] / derivePeriod_ / 5000 * mouseSensitivityDerived_;
-          }
-          else
-          {
-            halfAxes_[2*i + 0].absVal_ = 0.0f;
-            halfAxes_[2*i + 1].absVal_ = 0.0f;
-          }
-          //COUT(3) << mouseRelative_[i] << " | ";
-          mouseRelative_[i] = 0;
-        }
-        //COUT(3) << std::endl;
-      }
-      else
-        deriveTime_ += dt;
-    }
-
-    // execute all buffered bindings (addional parameter)
-    for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
-      paramCommandBuffer_[i]->execute();
-
-    // always reset the relative movement of the mouse
-    for (unsigned int i = 0; i < 8; i++)
-      halfAxes_[i].relVal_ = 0.0f;
-  }
-
-  void KeyBinder::keyPressed (const KeyEvent& evt)
-  { keys_[evt.key].execute(KeybindMode::OnPress); }
-
-  void KeyBinder::keyReleased(const KeyEvent& evt)
-  { keys_[evt.key].execute(KeybindMode::OnRelease); }
-
-  void KeyBinder::keyHeld    (const KeyEvent& evt)
-  { keys_[evt.key].execute(KeybindMode::OnHold); }
-
-
-  void KeyBinder::mouseButtonPressed (MouseButton::Enum id)
-  { mouseButtons_[id].execute(KeybindMode::OnPress); }
-
-  void KeyBinder::mouseButtonReleased(MouseButton::Enum id)
-  { mouseButtons_[id].execute(KeybindMode::OnRelease); }
-
-  void KeyBinder::mouseButtonHeld    (MouseButton::Enum id)
-  { mouseButtons_[id].execute(KeybindMode::OnHold); }
-
-
-  void KeyBinder::joyStickButtonPressed (int joyStickID, int button)
-  { joyStickButtons_[button].execute(KeybindMode::OnPress); }
-
-  void KeyBinder::joyStickButtonReleased(int joyStickID, int button)
-  { joyStickButtons_[button].execute(KeybindMode::OnRelease); }
-
-  void KeyBinder::joyStickButtonHeld    (int joyStickID, int button)
-  { joyStickButtons_[button].execute(KeybindMode::OnHold); }
-
-  /**
-    @brief Event handler for the mouseMoved Event.
-    @param e Mouse state information
-  */
-  void KeyBinder::mouseMoved(IntVector2 abs_, IntVector2 rel_, IntVector2 clippingSize)
-  {
-    if (!bDeriveMouseInput_)
-    {
-      // y axis of mouse input is inverted
-      int rel[] = { rel_.x, -rel_.y };
-
-      //COUT(3) << rel[0] << " | " << rel[1] << std::endl;
-
-      for (int i = 0; i < 2; i++)
-      {
-        if (rel[i])
-        {
-          // absolute
-          if (mousePosition_[i] >= 0)
-          {
-            mousePosition_[i] += rel[i];
-            halfAxes_[0 + 2*i].hasChanged_ = true;
-            if (mousePosition_[i] < 0)
-            {
-              halfAxes_[1 + 2*i].hasChanged_ = true;
-              halfAxes_[1 + 2*i].absVal_ = -((float)mousePosition_[i])/1024 * mouseSensitivity_;
-              halfAxes_[0 + 2*i].absVal_ =  0.0f;
-            }
-            else
-              halfAxes_[0 + 2*i].absVal_ =  ((float)mousePosition_[i])/1024 * mouseSensitivity_;
-          }
-          else
-          {
-            mousePosition_[i] += rel[i];
-            halfAxes_[1 + 2*i].hasChanged_ = true;
-            if (mousePosition_[i] > 0)
-            {
-              halfAxes_[0 + 2*i].hasChanged_ = true;
-              halfAxes_[0 + 2*i].absVal_ =  ((float)mousePosition_[i])/1024 * mouseSensitivity_;
-              halfAxes_[1 + 2*i].absVal_ =  0.0f;
-            }
-            else
-              halfAxes_[1 + 2*i].absVal_ = -((float)mousePosition_[i])/1024 * mouseSensitivity_;
-          }
-          //COUT(3) << "half axis 0: " << halfAxes_[0].absVal_ << std::endl;
-          //COUT(3) << "half axis 1: " << halfAxes_[1].absVal_ << std::endl;
-          //COUT(3) << "half axis 2: " << halfAxes_[2].absVal_ << std::endl;
-          //COUT(3) << "half axis 3: " << halfAxes_[3].absVal_ << std::endl;
-
-          // relative
-          if (rel[i] > 0)
-            halfAxes_[0 + 2*i].relVal_ =  ((float)rel[i])/1024 * mouseSensitivity_;
-          else
-            halfAxes_[1 + 2*i].relVal_ = -((float)rel[i])/1024 * mouseSensitivity_;
-        }
-      }
-    }
-    else
-    {
-      mouseRelative_[0] += rel_.x;
-      mouseRelative_[1] -= rel_.y;
-    }
-  }
-
-  /**
-    @brief Event handler for the mouseScrolled Event.
-    @param e Mouse state information
-  */
-  void KeyBinder::mouseScrolled(int abs, int rel)
-  {
-    //COUT(3) << mouseButtons_[8].name_ << "   " << abs << " | " << rel << std::endl;
-
-    if (rel > 0)
-      for (int i = 0; i < rel/120; i++)
-        mouseButtons_[8].execute(KeybindMode::OnPress, ((float)abs)/120.0f);
-    else
-      for (int i = 0; i < -rel/120; i++)
-        mouseButtons_[9].execute(KeybindMode::OnPress, ((float)abs)/120.0f);
-  }
-
-  void KeyBinder::joyStickAxisMoved(int joyStickID, int axis, int value)
-  {
-    // TODO: check whether 16 bit integer as general axis value is a good idea (works under windows)
-    int i = 8 + axis * 2;
-    if (value >= 0)
-    {
-      //if (value > 10000)
-      //{ CCOUT(3) << halfAxes_[i].name_ << std::endl; }
-
-      halfAxes_[i].absVal_ = ((float)value)/0x8000;
-      halfAxes_[i].relVal_ = ((float)value)/0x8000;
-      halfAxes_[i].hasChanged_ = true;
-      if (halfAxes_[i + 1].absVal_ > 0)
-      {
-        halfAxes_[i + 1].absVal_ = -0.0f;
-        halfAxes_[i + 1].relVal_ = -0.0f;
-        halfAxes_[i + 1].hasChanged_ = true;
-      }
-    }
-    else
-    {
-      //if (value < -10000)
-      //{ CCOUT(3) << halfAxes_[i + 1].name_ << std::endl; }
-
-      halfAxes_[i + 1].absVal_ = -((float)value)/0x8000;
-      halfAxes_[i + 1].relVal_ = -((float)value)/0x8000;
-      halfAxes_[i + 1].hasChanged_ = true;
-      if (halfAxes_[i].absVal_ > 0)
-      {
-        halfAxes_[i].absVal_ = -0.0f;
-        halfAxes_[i].relVal_ = -0.0f;
-        halfAxes_[i].hasChanged_ = true;
-      }
-    }
-  }
-
-
-  // ###############################
-  // ###     GUIInputHandler     ###
-  // ###############################
-
-  ///**
-  //  @brief standard constructor
-  //*/
-  //GUIInputHandler::GUIInputHandler()
-  //{
-  //}
-
-  ///**
-  //  @brief Destructor
-  //*/
-  //GUIInputHandler::~GUIInputHandler()
-  //{
-  //}
-
-  ///**
-  //  @brief Event handler for the keyPressed Event.
-  //  @param e Event information
-  //*/
-  //bool GUIInputHandler::keyPressed(const OIS::KeyEvent &e)
-  //{
-    ////CEGUI::System::getSingleton().injectKeyDown( arg.key );
-    ////CEGUI::System::getSingleton().injectChar( arg.text );
-  //  return true;
-  //}
-
-  ///**
-  //  @brief Event handler for the keyReleased Event.
-  //  @param e Event information
-  //*/
-  //bool GUIInputHandler::keyReleased(const OIS::KeyEvent &e)
-  //{
-    ////CEGUI::System::getSingleton().injectKeyUp( arg.key );
-  //  return true;
-  //}
-
-  ///**
-  //  @brief Event handler for the mouseMoved Event.
-  //  @param e Event information
-  //*/
-  //bool GUIInputHandler::mouseMoved(const OIS::MouseEvent &e)
-  //{
-    ////CEGUI::System::getSingleton().injectMouseMove( arg.state.X.rel, arg.state.Y.rel );
-  //  return true;
-  //}
-
-  ///**
-  //  @brief Event handler for the mousePressed Event.
-  //  @param e Event information
-  //  @param id The ID of the mouse button
-  //*/
-  //bool GUIInputHandler::mousePressed(const OIS::MouseEvent &e, OIS::MouseButton id)
-  //{
-    ////CEGUI::System::getSingleton().injectMouseButtonDown(convertOISMouseButtonToCegui(id));
-  //  return true;
-  //}
-
-  ///**
-  //  @brief Event handler for the mouseReleased Event.
-  //  @param e Event information
-  //  @param id The ID of the mouse button
-  //*/
-  //bool GUIInputHandler::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButton id)
-  //{
-    ////CEGUI::System::getSingleton().injectMouseButtonUp(convertOISMouseButtonToCegui(id));
-  //  return true;
-  //}
-
-}
Index: code/branches/network/src/core/InputHandler.h
===================================================================
--- code/branches/network/src/core/InputHandler.h	(revision 1412)
+++ 	(revision )
@@ -1,264 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-/**
- @file
- @brief Different definitions of input processing.
- */
-
-#ifndef _InputHandler_H__
-#define _InputHandler_H__
-
-#include "CorePrereqs.h"
-
-#include <string>
-#include <vector>
-
-#include "ois/OIS.h"
-#include "util/Math.h"
-#include "OrxonoxClass.h"
-#include "CommandExecutor.h"
-#include "InputInterfaces.h"
-
-namespace orxonox
-{
-  class _CoreExport BaseCommand
-  {
-  public:
-    virtual ~BaseCommand() { }
-    virtual bool execute(float abs = 1.0f, float rel = 1.0f) = 0;
-  };
-
-  class _CoreExport BufferedParamCommand
-  {
-  public:
-    BufferedParamCommand() : value_(0.0f), nValuesAdded_(0), paramIndex_(-1) { }
-    bool execute();
-
-    float value_;
-    unsigned int nValuesAdded_;
-    int paramIndex_;
-    CommandEvaluation evaluation_;
-  };
-
-  class _CoreExport SimpleCommand : public BaseCommand
-  {
-  public:
-    bool execute(float abs = 1.0f, float rel = 1.0f);
-
-    CommandEvaluation evaluation_;
-  };
-
-  class _CoreExport ParamCommand : public BaseCommand
-  {
-  public:
-    ParamCommand() : bRelative_(false), paramModifier_(1.0f), paramCommand_(0) { }
-    bool execute(float abs = 1.0f, float rel = 1.0f);
-
-    bool bRelative_;
-    float paramModifier_;
-    BufferedParamCommand* paramCommand_;
-  };
-
-  class _CoreExport Button
-  {
-  public:
-    Button() { nCommands_[0]=0; nCommands_[1]=0; nCommands_[2]=0; clear(); }
-    virtual ~Button() { clear(); }
-    virtual void clear();
-    virtual bool addParamCommand(ParamCommand* command) { return false; }
-    void parse(std::vector<BufferedParamCommand*>& paramCommandBuffer);
-    bool execute(KeybindMode::Enum mode, float abs = 1.0f, float rel = 1.0f);
-
-    //! The configured string value
-    std::string bindingString_;
-    //! Name of the trigger as strings
-    std::string name_;
-    //! Basic commands for OnPress, OnHold and OnRelease
-    BaseCommand** commands_[3];
-    //! Number of basic commands
-    unsigned int nCommands_[3];
-    //! Says how much it takes for an analog axis to trigger a button
-    //! Note: This variable is here to have only one parse() function.
-    float buttonThreshold_;
-  };
-
-
-  class _CoreExport HalfAxis : public Button
-  {
-  public:
-    HalfAxis() : relVal_(0.0f), absVal_(0.0f), paramCommands_(0), nParamCommands_(0),
-                 wasDown_(false), hasChanged_(false) { }
-    using Button::execute;
-    bool execute();
-    //bool execute(KeybindMode::Enum mode) { return Button::execute(mode); }
-    bool addParamCommand(ParamCommand* command);
-    void clear();
-
-    // axis related
-    float relVal_;
-    float absVal_;
-    ParamCommand** paramCommands_;
-    unsigned int nParamCommands_;
-
-    // button related
-    bool wasDown_;
-    bool hasChanged_;
-  };
-
-
-  /**
-    @brief Handles mouse, keyboard and joy stick input while in the actual game mode.
-           Manages the key bindings.
-  */
-  class _CoreExport KeyBinder : public KeyHandler, public MouseHandler, public JoyStickHandler, public OrxonoxClass
-  {
-  public:
-    KeyBinder ();
-    ~KeyBinder();
-
-    void loadBindings();
-    void clearBindings(bool bInit = false);
-
-    void setConfigValues();
-
-  private: // functions
-    void readTrigger(Button& button);
-
-    //static void clearBundle(KeyBindingBundle& bundle, bool bInit);
-    //static void redimensionBinding(KeyBinding& binding);
-
-    void tick(float dt);
-
-    void keyPressed (const KeyEvent& evt);
-    void keyReleased(const KeyEvent& evt);
-    void keyHeld    (const KeyEvent& evt);
-
-    void mouseButtonPressed (MouseButton::Enum id);
-    void mouseButtonReleased(MouseButton::Enum id);
-    void mouseButtonHeld    (MouseButton::Enum id);
-    void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
-    void mouseScrolled      (int abs, int rel);
-
-    void joyStickButtonPressed (int joyStickID, int button);
-    void joyStickButtonReleased(int joyStickID, int button);
-    void joyStickButtonHeld    (int joyStickID, int button);
-    void joyStickAxisMoved     (int joyStickID, int axis, int value);
-
-  private: // variables
-    //! denotes the number of different keys there are in OIS.
-    static const unsigned int nKeys_s = 0xEE;
-    //! Actual key bindings as bundle for Press, Hold and Release
-    Button keys_ [nKeys_s];
-
-    //! denotes the number of different mouse buttons there are in OIS.
-    static const unsigned int nMouseButtons_s = 8 + 2*2; // 8 buttons and 2 scroll wheels
-    //! Actual key bindings as bundle for Press, Hold and Release
-    Button mouseButtons_ [nMouseButtons_s];
-
-    //! denotes the number of different joy stick buttons there are in OIS.
-    static const unsigned int nJoyStickButtons_s = 32 + 4 * 4; // 32 buttons and 4 POVs with 4 buttons
-    //! Actual key bindings as bundle for Press, Hold and Release
-    Button joyStickButtons_ [nJoyStickButtons_s];
-
-    //! denotes the number of half axes (every axis twice) there can be.
-    static const unsigned int nHalfAxes_s = 56;
-    /**
-    * Array with all the half axes for mouse and joy sticks.
-    * Keep in mind that the positions are fixed and that the first entry is the
-    * positive one and the second is negative.
-    * Sequence is as follows:
-    *  0 -  3: Mouse x and y
-    *  4 -  7: empty
-    *  8 - 23: joy stick (slider) axes 1 to 8
-    * 24 - 55: joy stick axes 1 - 16
-    */
-    HalfAxis halfAxes_[nHalfAxes_s];
-
-    /**
-    * Commands that have additional parameters (axes) are executed at the end of
-    * the tick() so that all values can be buffered for single execution.
-    */
-    std::vector<BufferedParamCommand*> paramCommandBuffer_;
-
-    //! Keeps track of the absolute mouse value (incl. scroll wheel)
-    int mousePosition_[2];
-    //! Used to derive mouse input if requested
-    int mouseRelative_[2];
-    float deriveTime_;
-
-    //##### ConfigValues #####
-    //! Threshold for analog triggers until which the state is 0.
-    float analogThreshold_;
-    //! Threshold for analog triggers until which the button is not pressed.
-    float buttonThreshold_;
-    //! Derive mouse input for absolute values?
-    bool bDeriveMouseInput_;
-    //! Accuracy of the mouse input deriver. The higher the more precise, but laggier.
-    float derivePeriod_;
-    //! mouse sensitivity
-    float mouseSensitivity_;
-    //! mouse sensitivity if mouse input is derived
-    float mouseSensitivityDerived_;
-    //! default ini file for the keybindings
-    std::string keybindingsDefault_;
-  };
-
-
-  /**
-    @brief Captures mouse and keyboard input and distributes it to the
-    GUI.
-  */
-  //class _CoreExport GUIInputHandler : public KeyHandler, public MouseHandler, public JoyStickHandler
-  //{
-  //public:
-  //  GUIInputHandler ();
-  //  ~GUIInputHandler();
-
-  //private:
-  //  // input events
-    //bool keyPressed   (const OIS::KeyEvent   &arg);
-    //bool keyReleased  (const OIS::KeyEvent   &arg);
-    //bool keyHeld      (const OIS::KeyEvent   &arg);
-
-  //  bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButton id);
-    //bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButton id);
-    //bool mouseHeld    (const OIS::MouseEvent &arg, OIS::MouseButton id);
-  //  bool mouseMoved   (const OIS::MouseEvent &arg);
-
-    //bool buttonPressed (const OIS::JoyStickEvent &arg, int button);
-    //bool buttonReleased(const OIS::JoyStickEvent &arg, int button);
-    //bool buttonHeld    (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);
-  //};
-
-}
-
-#endif /* _InputHandler_H__ */
Index: code/branches/network/src/core/InputInterfaces.h
===================================================================
--- code/branches/network/src/core/InputInterfaces.h	(revision 1412)
+++ code/branches/network/src/core/InputInterfaces.h	(revision 1413)
@@ -254,4 +254,16 @@
 		std::vector<Vector3> mVectors;
   };*/
+  
+  /**
+  * Helper struct to determine which handlers of an object (can implement
+  * multiple handlers) are active.
+  */
+  struct HandlerState
+  {
+    HandlerState() : key(false), mouse(false), joyStick(false) { }
+    bool key;
+    bool mouse;
+    bool joyStick;
+  };
 
   class _CoreExport InputTickable
@@ -259,5 +271,5 @@
   public:
     virtual ~InputTickable() { }
-    virtual void tick(float dt) = 0;
+    virtual void tickInput(float dt, const HandlerState& state) = 0;
   };
 
@@ -272,4 +284,5 @@
     virtual void keyReleased(const KeyEvent& evt) = 0;
     virtual void keyHeld    (const KeyEvent& evt) = 0;
+    //virtual void tickKey    (float dt) { }
   };
 
@@ -286,4 +299,5 @@
     virtual void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) = 0;
     virtual void mouseScrolled      (int abs, int rel)     = 0;
+    //virtual void tickMouse          (float dt) { }
   };
 
@@ -301,4 +315,5 @@
     virtual void joyStickAxisMoved     (int joyStickID, int axis, int value) = 0;
     //virtual bool joyStickVector3Moved  (int joyStickID, int index /*, fill list*/) {return true;}
+    //virtual void tickJoyStick          (float dt) { }
   };
 
Index: code/branches/network/src/core/InputManager.cc
===================================================================
--- code/branches/network/src/core/InputManager.cc	(revision 1412)
+++ code/branches/network/src/core/InputManager.cc	(revision 1413)
@@ -37,5 +37,5 @@
 #include "Debug.h"
 #include "InputBuffer.h"
-#include "InputHandler.h"
+#include "KeyBinder.h"
 
 namespace orxonox
@@ -52,4 +52,5 @@
   InputManager::InputManager() :
       inputSystem_(0), keyboard_(0), mouse_(0),
+      keyBinder_(0), buffer_(0),
       joySticksSize_(0),
       state_(IS_UNINIT), stateRequest_(IS_UNINIT),
@@ -144,15 +145,18 @@
 
     // InputManager holds the input buffer --> create one and add it.
-    addKeyHandler(new InputBuffer(), "buffer");
-
-    KeyBinder* binder = new KeyBinder();
-    binder->loadBindings();
-    addKeyHandler(binder, "keybinder");
-    addMouseHandler(binder, "keybinder");
-    addJoyStickHandler(binder, "keybinder");
-
-    // Read all the key bindings and assign them
-    //if (!_loadBindings())
-    //  return false;
+    buffer_ = new InputBuffer();
+    addKeyHandler(buffer_, "buffer");
+
+    keyBinder_ = new KeyBinder();
+    keyBinder_->loadBindings();
+    addKeyHandler(keyBinder_, "keybinder");
+    addMouseHandler(keyBinder_, "keybinder");
+    addJoyStickHandler(keyBinder_, "keybinder");
+
+    keyDetector_ = new KeyDetector();
+    keyDetector_->loadBindings();
+    addKeyHandler(keyDetector_, "keydetector");
+    addMouseHandler(keyDetector_, "keydetector");
+    addJoyStickHandler(keyDetector_, "keydetector");
 
     CCOUT(ORX_DEBUG) << "Initialising complete." << std::endl;
@@ -288,9 +292,12 @@
       CCOUT(ORX_DEBUG) << "Destroying ..." << std::endl;
 
-      if (keyHandlers_.find("buffer") != keyHandlers_.end())
-        delete keyHandlers_["buffer"];
-
-      if (keyHandlers_.find("keybinder") != keyHandlers_.end())
-        delete keyHandlers_["keybinder"];
+      if (buffer_)
+        delete buffer_;
+
+      if (keyBinder_)
+        delete keyBinder_;
+
+      if (keyDetector_)
+        delete keyDetector_;
 
       keyHandlers_.clear();
@@ -361,18 +368,19 @@
   void InputManager::_updateTickables()
   {
-    // we can use a set to have a list of unique pointers (an object can implement all 3 handlers)
-    std::set<InputTickable*> tempSet;
+    // we can use a map to have a list of unique pointers (an object can implement all 3 handlers)
+    std::map<InputTickable*, HandlerState> tempSet;
     for (unsigned int iHandler = 0; iHandler < activeKeyHandlers_.size(); iHandler++)
-      tempSet.insert(activeKeyHandlers_[iHandler]);
+      tempSet[activeKeyHandlers_[iHandler]].joyStick = true;
     for (unsigned int iHandler = 0; iHandler < activeMouseHandlers_.size(); iHandler++)
-      tempSet.insert(activeMouseHandlers_[iHandler]);
+      tempSet[activeMouseHandlers_[iHandler]].mouse = true;
     for (unsigned int iJoyStick  = 0; iJoyStick < joySticksSize_; iJoyStick++)
       for (unsigned int iHandler = 0; iHandler  < activeJoyStickHandlers_[iJoyStick].size(); iHandler++)
-        tempSet.insert(activeJoyStickHandlers_[iJoyStick][iHandler]);
-
-    // copy the content of the set back to the actual vector
+        tempSet[activeJoyStickHandlers_[iJoyStick][iHandler]].joyStick = true;
+
+    // copy the content of the map back to the actual vector
     activeHandlers_.clear();
-    for (std::set<InputTickable*>::const_iterator itHandler = tempSet.begin(); itHandler != tempSet.end(); itHandler++)
-      activeHandlers_.push_back(*itHandler);
+    for (std::map<InputTickable*, HandlerState>::const_iterator itHandler = tempSet.begin();
+        itHandler != tempSet.end(); itHandler++)
+      activeHandlers_.push_back(std::pair<InputTickable*, HandlerState>((*itHandler).first, (*itHandler).second));
   }
 
@@ -422,4 +430,18 @@
           break;
 
+        case IS_DETECTION:
+          if (mouse_)
+            mouse_->capture();
+          if (keyboard_)
+            keyboard_->capture();
+          for (unsigned  int i = 0; i < joySticksSize_; i++)
+            joySticks_[i]->capture();
+
+          lastStroke_ = "";
+          enableKeyHandler("keydetector");
+          enableMouseHandler("keydetector");
+          enableJoyStickHandler("keydetector", 0);
+          break;
+
         default:
           break;
@@ -455,7 +477,15 @@
 
 
-    // call the ticks
+    // call the ticks for the handlers (need to be treated specially)
     for (unsigned int iHandler = 0; iHandler < activeHandlers_.size(); iHandler++)
-      activeHandlers_[iHandler]->tick(dt);
+      activeHandlers_[iHandler].first->tickInput(dt, activeHandlers_[iHandler].second);
+
+    /*for (unsigned int iHandler = 0; iHandler < activeKeyHandlers_.size(); iHandler++)
+      activeKeyHandlers_[iHandler]->tickKey(dt);
+    for (unsigned int iHandler = 0; iHandler < activeMouseHandlers_.size(); iHandler++)
+      activeMouseHandlers_[iHandler]->tickMouse(dt);
+    for (unsigned int iJoyStick  = 0; iJoyStick < joySticksSize_; iJoyStick++)
+      for (unsigned int iHandler = 0; iHandler < activeJoyStickHandlers_[iJoyStick].size(); iHandler++)
+        activeJoyStickHandlers_[iJoyStick][iHandler]->tickJoyStick(dt);*/
   }
 
@@ -781,5 +811,5 @@
   }
 
-  bool InputManager::isKeyDown(KeyCode::Enum key)
+  /*bool InputManager::isKeyDown(KeyCode::Enum key)
   {
     if (_getSingleton().keyboard_)
@@ -787,7 +817,7 @@
     else
       return false;
-  }
-
-  bool InputManager::isModifierDown(KeyboardModifier::Enum modifier)
+  }*/
+
+  /*bool InputManager::isModifierDown(KeyboardModifier::Enum modifier)
   {
     if (_getSingleton().keyboard_)
@@ -795,5 +825,5 @@
     else
       return false;
-  }
+  }*/
 
   /*const MouseState InputManager::getMouseState()
@@ -812,5 +842,4 @@
       return JoyStickState();
   }*/
-
 
   void InputManager::destroy()
@@ -871,4 +900,15 @@
   }
 
+  void InputManager::storeKeyStroke(const std::string& name)
+  {
+    if (_getSingleton().lastStroke_ == "")
+      _getSingleton().lastStroke_ = name;
+  }
+
+  const std::string& InputManager::getLastKeyStroke()
+  {
+    return _getSingleton().lastStroke_;
+  }
+
 
   // ###### KeyHandler ######
Index: code/branches/network/src/core/InputManager.h
===================================================================
--- code/branches/network/src/core/InputManager.h	(revision 1412)
+++ code/branches/network/src/core/InputManager.h	(revision 1413)
@@ -80,10 +80,11 @@
     enum InputState
     {
-      IS_UNINIT,  //!< InputManager has not yet been initialised.
-      IS_NONE,    //!< Input is discarded.
-      IS_NORMAL,  //!< Normal play state. Key and button bindings are active.
-      IS_GUI,     //!< All OIS input events are passed to CEGUI.
-      IS_CONSOLE, //!< Keyboard input is redirected to the InputBuffer.
-      IS_CUSTOM   //!< Any possible configuration.
+      IS_UNINIT,    //!< InputManager has not yet been initialised.
+      IS_NONE,      //!< Input is discarded.
+      IS_NORMAL,    //!< Normal play state. Key and button bindings are active.
+      IS_GUI,       //!< All OIS input events are passed to CEGUI.
+      IS_CONSOLE,   //!< Keyboard input is redirected to the InputBuffer.
+      IS_DETECTION, //!< All the input goes to the KeyDetector
+      IS_CUSTOM     //!< Any possible configuration.
     };
 
@@ -103,6 +104,6 @@
     static void destroyJoySticks();
 
-    static bool isModifierDown(KeyboardModifier::Enum modifier);
-    static bool isKeyDown(KeyCode::Enum key);
+    //static bool isModifierDown(KeyboardModifier::Enum modifier);
+    //static bool isKeyDown(KeyCode::Enum key);
     //static const MouseState getMouseState();
     //static const JoyStickState getJoyStickState(unsigned int ID);
@@ -112,4 +113,7 @@
     static void setInputState(const InputState state);
     static InputState getInputState();
+
+    static void storeKeyStroke(const std::string& name);
+    static const std::string& getLastKeyStroke();
 
     static bool addKeyHandler                 (KeyHandler* handler, const std::string& name);
@@ -172,13 +176,18 @@
 
   private: // variables
-    OIS::InputManager*                          inputSystem_; //!< OIS input manager
-    OIS::Keyboard*                              keyboard_;    //!< OIS mouse
-    OIS::Mouse*                                 mouse_;       //!< OIS keyboard
-    std::vector<OIS::JoyStick*>                 joySticks_;   //!< OIS joy sticks
+    OIS::InputManager*                          inputSystem_;     //!< OIS input manager
+    OIS::Keyboard*                              keyboard_;        //!< OIS mouse
+    OIS::Mouse*                                 mouse_;           //!< OIS keyboard
+    std::vector<OIS::JoyStick*>                 joySticks_;       //!< OIS joy sticks
     unsigned int                                joySticksSize_;
+
+    KeyBinder*                                  keyBinder_;       //!< KeyBinder instance
+    KeyDetector*                                keyDetector_;     //!< KeyDetector instance
+    InputBuffer*                                buffer_;          //!< InputBuffer instance
 
     InputState state_;
     InputState stateRequest_;
     unsigned int keyboardModifiers_;
+    std::string lastStroke_;
 
     //! Keeps track of the joy stick POV states
@@ -194,5 +203,5 @@
     std::vector<MouseHandler*>                  activeMouseHandlers_;
     std::vector<std::vector<JoyStickHandler*> > activeJoyStickHandlers_;
-    std::vector<InputTickable*>                 activeHandlers_;
+    std::vector<std::pair<InputTickable*, HandlerState> > activeHandlers_;
 
     std::vector<Key>                            keysDown_;
Index: code/branches/network/src/core/KeyBinder.cc
===================================================================
--- code/branches/network/src/core/KeyBinder.cc	(revision 1413)
+++ code/branches/network/src/core/KeyBinder.cc	(revision 1413)
@@ -0,0 +1,852 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of the different input handlers.
+ */
+
+#include "KeyBinder.h"
+#include <fstream>
+#include "util/Convert.h"
+#include "util/SubString.h"
+#include "util/String.h"
+#include "Debug.h"
+#include "ConfigValueIncludes.h"
+#include "CoreIncludes.h"
+#include "CommandExecutor.h"
+#include "Executor.h"
+
+namespace orxonox
+{
+  // ###############################
+  // ######      Button       ######
+  // ###############################
+
+  bool BufferedParamCommand::execute()
+  {
+    if (nValuesAdded_)
+    {
+      BufferedParamCommand& cmd = *this;
+      cmd.evaluation_.setEvaluatedParameter(cmd.paramIndex_, cmd.value_);
+      // reset
+      cmd.nValuesAdded_ = 0;
+      cmd.value_ = 0;
+      return CommandExecutor::execute(cmd.evaluation_);
+    }
+    else
+      return true;
+  }
+
+  bool SimpleCommand::execute(float abs, float rel)
+  {
+    return CommandExecutor::execute(evaluation_);
+  }
+
+  bool ParamCommand::execute(float abs, float rel)
+  {
+    BufferedParamCommand& paramCommand = *paramCommand_;
+    // command has an additional parameter
+    if (bRelative_ && (rel > 0 || rel < 0))
+    {
+      // we have to calculate a relative movement.
+      // paramModifier_ says how much one keystroke is
+      paramCommand.value_ += paramModifier_ * rel;
+    }
+    else if (abs > 0 || abs < 0)
+    {
+      // we have to calculate absolute position of the axis.
+      // Since there might be another axis that is affected, we have to wait and
+      // store the result in a temporary place
+      paramCommand.value_ = (paramCommand.value_ * paramCommand.nValuesAdded_ + paramModifier_ * abs)
+                            /++paramCommand.nValuesAdded_;
+    }
+    return true;
+  }
+
+  void Button::clear()
+  {
+    for (unsigned int j = 0; j < 3; j++)
+    {
+      if (nCommands_[j])
+      {
+        // delete all commands and the command pointer array
+        for (unsigned int i = 0; i < nCommands_[j]; i++)
+          delete commands_[j][i];
+        delete[] commands_[j];
+        commands_[j] = 0;
+        nCommands_[j] = 0;
+      }
+      else
+      {
+        commands_[j] = 0;
+      }
+    }
+  }
+
+  void Button::parse(std::vector<BufferedParamCommand*>& paramCommandBuffer)
+  {
+    if (isEmpty(bindingString_))
+    {
+      clear();
+      return;
+    }
+
+    // use std::vector for a temporary dynamic array
+    std::vector<BaseCommand*> commands[3];
+
+
+    // separate the commands
+    SubString commandStrings(bindingString_, "|", SubString::WhiteSpaces, false,
+        '\\', false, '"', false, '(', ')', false, '\0');
+
+    for (unsigned int iCommand = 0; iCommand < commandStrings.size(); iCommand++)
+    {
+      if (commandStrings[iCommand] != "")
+      {
+        SubString tokens(commandStrings[iCommand], " ", SubString::WhiteSpaces, false,
+            '\\', false, '"', false, '(', ')', false, '\0');
+        
+        unsigned int iToken = 0;
+
+        // for real axes, we can feed a ButtonThreshold argument as entire command
+        if (getLowercase(tokens[0]) == "buttonthreshold")
+        {
+          if (tokens.size() == 1)
+            continue;
+          // may fail, but doesn't matter
+          convertValue(&buttonThreshold_, tokens[1]);
+          continue;
+        }
+
+        // first argument can be OnPress, OnHold OnRelease or nothing
+        KeybindMode::Enum mode = KeybindMode::None;
+        if (getLowercase(tokens[iToken]) == "onpress")
+          mode = KeybindMode::OnPress,   iToken++;
+        if (getLowercase(tokens[iToken]) == "onrelease")
+          mode = KeybindMode::OnRelease, iToken++;
+        if (getLowercase(tokens[iToken]) == "onhold")
+          mode = KeybindMode::OnHold,    iToken++;
+
+        if (iToken == tokens.size())
+          continue;
+
+        // second argument can be the amplitude for the case it as an axis command
+        // default amplitude is 1.0f
+        float paramModifier = 1.0f;
+        if (getLowercase(tokens[iToken]) == "scale")
+        {
+          iToken++;
+          if (iToken == tokens.size() || !convertValue(&paramModifier, tokens[iToken]))
+          {
+            COUT(2) << "Error while parsing key binding " << name_
+                << ". Numeric expression expected afer 'AxisAmp', switching to default value" << std::endl;
+            if (iToken == tokens.size())
+              continue;
+          }
+          iToken++;
+        }
+
+        // no more arguments expected except for the actual command
+        if (iToken == tokens.size())
+          continue;
+
+        std::string commandStr;
+        while (iToken != tokens.size())
+          commandStr += tokens[iToken++] + " ";
+
+        // evaluate the command
+        CommandEvaluation eval = CommandExecutor::evaluate(commandStr);
+        if (!eval.isValid())
+          continue;
+
+        // check for param command
+        int paramIndex = eval.getEvaluatedExecutor()->getAxisParamIndex();
+        // TODO: check in Executor for correct paramIndex
+        if (paramIndex >= 0)
+        {
+          // parameter supported command
+          ParamCommand* cmd = new ParamCommand();
+          cmd->paramModifier_ = paramModifier;
+          cmd->bRelative_ = eval.getEvaluatedExecutor()->getIsAxisRelative();
+
+          // add command to the buffer if not yet existing
+          for (unsigned int iParamCmd = 0; iParamCmd < paramCommandBuffer.size(); iParamCmd++)
+          {
+            if (getLowercase(paramCommandBuffer[iParamCmd]->evaluation_.getCommandString())
+                == getLowercase(commandStr))
+            {
+              // already in list
+              cmd->paramCommand_ = paramCommandBuffer[iParamCmd];
+              break;
+            }
+          }
+          if (cmd->paramCommand_ == 0)
+          {
+            cmd->paramCommand_ = new BufferedParamCommand();
+            paramCommandBuffer.push_back(cmd->paramCommand_);
+            cmd->paramCommand_->evaluation_ = eval;
+            cmd->paramCommand_->paramIndex_ = paramIndex;
+          }
+
+
+          // we don't know whether this is an actual axis or just a button
+          if (mode == KeybindMode::None)
+          {
+            if (!addParamCommand(cmd))
+            {
+              mode = eval.getEvaluatedExecutor()->getKeybindMode();
+              commands[mode].push_back(cmd);
+            }
+          }
+        }
+        else
+        {
+          SimpleCommand* cmd = new SimpleCommand();
+          cmd->evaluation_ = eval;
+
+          //TODO: check CommandEvaluation for correct KeybindMode
+          if (mode == KeybindMode::None)
+            mode = eval.getEvaluatedExecutor()->getKeybindMode();
+
+          commands[mode].push_back(cmd);
+        }
+      }
+    }
+
+    for (unsigned int j = 0; j < 3; j++)
+    {
+      nCommands_[j] = commands[j].size();
+      if (nCommands_[j])
+      {
+        commands_[j] = new BaseCommand*[nCommands_[j]];
+        for (unsigned int i = 0; i < commands[j].size(); i++)
+          commands_[j][i] = commands[j][i];
+      }
+      else
+        commands_[j] = 0;
+    }
+  }
+
+  bool Button::execute(KeybindMode::Enum mode, float abs, float rel)
+  {
+    // execute all the parsed commands in the string
+    for (unsigned int iCommand = 0; iCommand < nCommands_[mode]; iCommand++)
+      commands_[mode][iCommand]->execute(abs, rel);
+    return true;
+  }
+
+  void HalfAxis::clear()
+  {
+    Button::clear();
+    if (nParamCommands_)
+    {
+      // delete all commands and the command pointer array
+      for (unsigned int i = 0; i < nParamCommands_; i++)
+        delete paramCommands_[i];
+      delete[] paramCommands_;
+    }
+    else
+    {
+      nParamCommands_ = 0; nParamCommands_ = 0;
+    }
+  }
+  
+  bool HalfAxis::addParamCommand(ParamCommand* command)
+  {
+    ParamCommand** cmds = paramCommands_;
+    paramCommands_ = new ParamCommand*[++nParamCommands_];
+    unsigned int i;
+    for (i = 0; i < nParamCommands_ - 1; i++)
+      paramCommands_[i] = cmds[i];
+    paramCommands_[i] = command;
+    delete[] cmds;
+    return true;
+  }
+
+  bool HalfAxis::execute()
+  {
+    bool success = true;
+    for (unsigned int i = 0; i < nParamCommands_; i++)
+      success = success && paramCommands_[i]->execute(absVal_, relVal_);
+    return success;
+  }
+
+
+  // ###############################
+  // ######     KeyBinder     ######
+  // ###############################
+
+  /**
+    @brief Constructor that does as little as necessary.
+  */
+  KeyBinder::KeyBinder() : deriveTime_(0.0f)
+  {
+    mouseRelative_[0] = 0;
+    mouseRelative_[1] = 0;
+    mousePosition_[0] = 0;
+    mousePosition_[1] = 0;
+
+    RegisterObject(KeyBinder);
+
+    // keys
+    std::string keyNames[] = {
+      "UNASSIGNED",
+      "ESCAPE",
+      "1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
+      "MINUS", "EQUALS", "BACK", "TAB",
+      "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P",
+      "LBRACKET", "RBRACKET",
+      "RETURN", "LCONTROL",
+      "A", "S", "D", "F", "G", "H", "J", "K", "L",
+      "SEMICOLON", "APOSTROPHE", "GRAVE",
+      "LSHIFT", "BACKSLASH",
+      "Z", "X", "C", "V", "B", "N", "M",
+      "COMMA", "PERIOD", "SLASH",
+      "RSHIFT",
+      "MULTIPLY",
+      "LMENU",
+      "SPACE",
+      "CAPITAL",
+      "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10",
+      "NUMLOCK", "SCROLL",
+      "NUMPAD7", "NUMPAD8", "NUMPAD9",
+      "SUBTRACT",
+      "NUMPAD4", "NUMPAD5", "NUMPAD6",
+      "ADD",
+      "NUMPAD1", "NUMPAD2", "NUMPAD3", "NUMPAD0",
+      "DECIMAL",
+      "","",
+      "OEM_102",
+      "F11", "F12",
+      "","","","","","","","","","","",
+      "F13", "F14", "F15",
+      "","","","","","","","","","",
+      "KANA",
+      "","",
+      "ABNT_C1",
+      "","","","","",
+      "CONVERT",
+      "",
+      "NOCONVERT",
+      "",
+      "YEN",
+      "ABNT_C2",
+      "","","","","","","","","","","","","","",
+      "NUMPADEQUALS",
+      "","",
+      "PREVTRACK",
+      "AT",
+      "COLON", "UNDERLINE",
+      "KANJI",
+      "STOP",
+      "AX",
+      "UNLABELED",
+      "NEXTTRACK",
+      "","",
+      "NUMPADENTER",
+      "RCONTROL",
+      "","",
+      "MUTE",
+      "CALCULATOR",
+      "PLAYPAUSE",
+      "",
+      "MEDIASTOP",
+      "","","","","","","","","",
+      "VOLUMEDOWN",
+      "",
+      "VOLUMEUP",
+      "",
+      "WEBHOME",
+      "NUMPADCOMMA",
+      "",
+      "DIVIDE",
+      "",
+      "SYSRQ",
+      "RMENU",
+      "","","","","","","","","","","","",
+      "PAUSE",
+      "",
+      "HOME",
+      "UP",
+      "PGUP",
+      "",
+      "LEFT",
+      "",
+      "RIGHT",
+      "",
+      "END", "DOWN", "PGDOWN", "INSERT", "DELETE",
+      "","","","","","","",
+      "LWIN", "RWIN", "APPS",
+      "POWER", "SLEEP",
+      "","","",
+      "WAKE",
+      "",
+      "WEBSEARCH", "WEBFAVORITES", "WEBREFRESH", "WEBSTOP", "WEBFORWARD", "WEBBACK",
+      "MYCOMPUTER", "MAIL", "MEDIASELECT"
+    };
+    for (unsigned int i = 0; i < nKeys_s; i++)
+      keys_[i].name_ = "Key" + keyNames[i];
+
+    // mouse buttons
+    std::string mouseButtonNames[] = {
+      "MouseLeft", "MouseRight", "MouseMiddle",
+      "MouseButton3", "MouseButton4", "MouseButton5",
+      "MouseButton6", "MouseButton7",
+      "MouseWheel1Up", "MouseWheel1Down",
+      "MouseWheel2Up", "MouseWheel2Down" };
+    for (unsigned int i = 0; i < nMouseButtons_s; i++)
+      mouseButtons_[i].name_ = mouseButtonNames[i];
+
+    // joy stick buttons
+    for (unsigned int i = 0; i < 32; i++)
+      joyStickButtons_[i].name_ = "JoyButton" + getConvertedValue<int, std::string>(i);
+    for (unsigned int i = 32; i < nJoyStickButtons_s; i += 4)
+    {
+		  joyStickButtons_[i + 0].name_ = "JoyPOV" + getConvertedValue<int, std::string>((i - 32)/4 + 1) + "North";
+		  joyStickButtons_[i + 1].name_ = "JoyPOV" + getConvertedValue<int, std::string>((i - 32)/4 + 1) + "South";
+		  joyStickButtons_[i + 2].name_ = "JoyPOV" + getConvertedValue<int, std::string>((i - 32)/4 + 1) + "East";
+		  joyStickButtons_[i + 3].name_ = "JoyPOV" + getConvertedValue<int, std::string>((i - 32)/4 + 1) + "West";
+    }
+
+    // half axes
+    std::string rawNames[nHalfAxes_s/2];
+    rawNames[0] = "MouseX";
+    rawNames[1] = "MouseY";
+    rawNames[2] = "Empty1";
+    rawNames[3] = "Empty2";
+    for (unsigned int i = 4; i < nHalfAxes_s/2; i++)
+      rawNames[i] = "JoyAxis" + getConvertedValue<int, std::string>(i - 3);
+    for (unsigned int i = 0; i < nHalfAxes_s/2; i++)
+    {
+      halfAxes_[i * 2 + 0].name_ = rawNames[i] + "Pos";
+      halfAxes_[i * 2 + 1].name_ = rawNames[i] + "Neg";
+    }
+
+    for (unsigned int i = 0; i < this->nHalfAxes_s; i++)
+      halfAxes_[i].buttonThreshold_ = buttonThreshold_;
+  }
+
+  /**
+    @brief Destructor
+  */
+  KeyBinder::~KeyBinder()
+  {
+    // almost no destructors required because most of the arrays are static.
+    clearBindings(); // does some destruction work
+  }
+
+  /**
+    @brief Loads the key and button bindings.
+    @return True if loading succeeded.
+  */
+  void KeyBinder::loadBindings()
+  {
+    COUT(3) << "KeyBinder: Loading key bindings..." << std::endl;
+
+    clearBindings();
+
+    std::ifstream infile;
+    infile.open("keybindings.ini");
+    if (!infile.is_open())
+    {
+      ConfigFileManager::getSingleton()->setFile(CFT_Keybindings, keybindingsDefault_);
+      ConfigFileManager::getSingleton()->save(CFT_Keybindings, "keybindings.ini");
+    }
+    infile.close();
+    ConfigFileManager::getSingleton()->setFile(CFT_Keybindings, "keybindings.ini");
+
+    // parse key bindings
+    setConfigValues();
+
+    COUT(3) << "KeyBinder: Loading key bindings done." << std::endl;
+  }
+
+  /**
+    @brief Loader for the key bindings, managed by config values.
+  */
+  void KeyBinder::setConfigValues()
+  {
+    SetConfigValue(analogThreshold_, 0.01f)  .description("Threshold for analog axes until which the state is 0.");
+    SetConfigValue(mouseSensitivity_, 1.0f)  .description("Mouse sensitivity.");
+    SetConfigValue(bDeriveMouseInput_, false).description("Whether or not to derive moues movement for the absolute value.");
+    SetConfigValue(derivePeriod_, 0.1f).description("Accuracy of the mouse input deriver. The higher the more precise, but laggier.");
+    SetConfigValue(mouseSensitivityDerived_, 1.0f).description("Mouse sensitivity if mouse input is derived.");
+    SetConfigValue(keybindingsDefault_, "def_keybindings.ini").description("Default ini file for the keybindings.");
+
+    float oldThresh = buttonThreshold_;
+    SetConfigValue(buttonThreshold_, 0.80f).description("Threshold for analog axes until which the button is not pressed.");
+    if (oldThresh != buttonThreshold_)
+      for (unsigned int i = 0; i < nHalfAxes_s; i++)
+        if (halfAxes_[i].buttonThreshold_ == oldThresh)
+          halfAxes_[i].buttonThreshold_ = buttonThreshold_;
+
+    // keys
+    for (unsigned int i = 0; i < nKeys_s; i++)
+      readTrigger(keys_[i]);
+    // mouse buttons
+    for (unsigned int i = 0; i < nMouseButtons_s; i++)
+      readTrigger(mouseButtons_[i]);
+    // joy stick buttons
+    for (unsigned int i = 0; i < nJoyStickButtons_s; i++)
+      readTrigger(joyStickButtons_[i]);
+    // half axes
+    for (unsigned int i = 0; i < nHalfAxes_s; i++)
+      readTrigger(halfAxes_[i]);
+  }
+
+  void KeyBinder::readTrigger(Button& button)
+  {
+    // config value stuff
+    ConfigValueContainer* cont = getIdentifier()->getConfigValueContainer(button.name_);
+    if (!cont)
+    {
+      cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), button.name_, "");
+      getIdentifier()->addConfigValueContainer(button.name_, cont);
+    }
+    std::string old = button.bindingString_;
+    cont->getValue(&button.bindingString_);
+
+    // keybinder stuff
+    if (old != button.bindingString_)
+    {
+      // binding has changed
+      button.parse(paramCommandBuffer_);
+    }
+  }
+
+  /**
+    @brief Overwrites all bindings with ""
+  */
+  void KeyBinder::clearBindings()
+  {
+    for (unsigned int i = 0; i < nKeys_s; i++)
+      keys_[i].clear();
+
+    for (unsigned int i = 0; i < nMouseButtons_s; i++)
+      mouseButtons_[i].clear();
+
+    for (unsigned int i = 0; i < nJoyStickButtons_s; i++)
+      joyStickButtons_[i].clear();
+
+    for (unsigned int i = 0; i < nHalfAxes_s; i++)
+      halfAxes_[i].clear();
+
+    for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
+      delete paramCommandBuffer_[i];
+    paramCommandBuffer_.clear();
+  }
+
+  void KeyBinder::tickInput(float dt, const HandlerState& state)
+  {
+    // we have to process all the analog input since there is e.g. no 'mouseDoesntMove' event.
+    unsigned int iBegin = 8;
+    unsigned int iEnd   = 8;
+    if (state.joyStick)
+      iEnd = nHalfAxes_s;
+    if (state.mouse)
+      iBegin = 0;
+    for (unsigned int i = iBegin; i < iEnd; i++)
+    {
+      if (halfAxes_[i].hasChanged_)
+      {
+        if (!halfAxes_[i].wasDown_ && halfAxes_[i].absVal_ > halfAxes_[i].buttonThreshold_)
+        {
+          halfAxes_[i].wasDown_ = true;
+          if (halfAxes_[i].nCommands_[KeybindMode::OnPress])
+            halfAxes_[i].execute(KeybindMode::OnPress);
+        }
+        else if (halfAxes_[i].wasDown_ && halfAxes_[i].absVal_ < halfAxes_[i].buttonThreshold_)
+        {
+          halfAxes_[i].wasDown_ = false;
+          if (halfAxes_[i].nCommands_[KeybindMode::OnRelease])
+            halfAxes_[i].execute(KeybindMode::OnRelease);
+        }
+        if (halfAxes_[i].wasDown_)
+        {
+          if (halfAxes_[i].nCommands_[KeybindMode::OnHold])
+            halfAxes_[i].execute(KeybindMode::OnHold);
+        }
+        halfAxes_[i].hasChanged_ = false;
+      }
+
+      // these are the actually useful axis bindings for analog input AND output
+      if (halfAxes_[i].relVal_ > analogThreshold_ || halfAxes_[i].absVal_ > analogThreshold_)
+      {
+        //COUT(3) << halfAxes_[i].name_ << "\t" << halfAxes_[i].absVal_ << std::endl;
+        halfAxes_[i].execute();
+      }
+    }
+
+    if (bDeriveMouseInput_ && state.mouse)
+    {
+      if (deriveTime_ > derivePeriod_)
+      {
+        //CCOUT(3) << "mouse abs: ";
+        for (int i = 0; i < 2; i++)
+        {
+          if (mouseRelative_[i] > 0)
+          {
+            halfAxes_[2*i + 0].absVal_ =  mouseRelative_[i] / deriveTime_ * 0.0005 * mouseSensitivityDerived_;
+            halfAxes_[2*i + 1].absVal_ = 0.0f;
+          }
+          else if (mouseRelative_[i] < 0)
+          {
+            halfAxes_[2*i + 0].absVal_ = 0.0f;
+            halfAxes_[2*i + 1].absVal_ = -mouseRelative_[i] / deriveTime_ * 0.0005 * mouseSensitivityDerived_;
+          }
+          else
+          {
+            halfAxes_[2*i + 0].absVal_ = 0.0f;
+            halfAxes_[2*i + 1].absVal_ = 0.0f;
+          }
+          //COUT(3) << mouseRelative_[i] << " | ";
+          mouseRelative_[i] = 0;
+        }
+        deriveTime_ = 0.0f;
+        //COUT(3) << std::endl;
+      }
+      else
+        deriveTime_ += dt;
+    }
+
+    // execute all buffered bindings (addional parameter)
+    for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
+      paramCommandBuffer_[i]->execute();
+
+    // always reset the relative movement of the mouse
+    if (state.mouse)
+      for (unsigned int i = 0; i < 8; i++)
+        halfAxes_[i].relVal_ = 0.0f;
+  }
+
+  void KeyBinder::keyPressed (const KeyEvent& evt)
+  { keys_[evt.key].execute(KeybindMode::OnPress); }
+
+  void KeyBinder::keyReleased(const KeyEvent& evt)
+  { keys_[evt.key].execute(KeybindMode::OnRelease); }
+
+  void KeyBinder::keyHeld    (const KeyEvent& evt)
+  { keys_[evt.key].execute(KeybindMode::OnHold); }
+
+
+  void KeyBinder::mouseButtonPressed (MouseButton::Enum id)
+  { mouseButtons_[id].execute(KeybindMode::OnPress); }
+
+  void KeyBinder::mouseButtonReleased(MouseButton::Enum id)
+  { mouseButtons_[id].execute(KeybindMode::OnRelease); }
+
+  void KeyBinder::mouseButtonHeld    (MouseButton::Enum id)
+  { mouseButtons_[id].execute(KeybindMode::OnHold); }
+
+
+  void KeyBinder::joyStickButtonPressed (int joyStickID, int button)
+  { joyStickButtons_[button].execute(KeybindMode::OnPress); }
+
+  void KeyBinder::joyStickButtonReleased(int joyStickID, int button)
+  { joyStickButtons_[button].execute(KeybindMode::OnRelease); }
+
+  void KeyBinder::joyStickButtonHeld    (int joyStickID, int button)
+  { joyStickButtons_[button].execute(KeybindMode::OnHold); }
+
+  /**
+    @brief Event handler for the mouseMoved Event.
+    @param e Mouse state information
+  */
+  void KeyBinder::mouseMoved(IntVector2 abs_, IntVector2 rel_, IntVector2 clippingSize)
+  {
+    if (!bDeriveMouseInput_)
+    {
+      // y axis of mouse input is inverted
+      int rel[] = { rel_.x, -rel_.y };
+
+      //COUT(3) << rel[0] << " | " << rel[1] << std::endl;
+
+      for (int i = 0; i < 2; i++)
+      {
+        if (rel[i])
+        {
+          // absolute
+          if (mousePosition_[i] >= 0)
+          {
+            mousePosition_[i] += rel[i];
+            halfAxes_[0 + 2*i].hasChanged_ = true;
+            if (mousePosition_[i] < 0)
+            {
+              halfAxes_[1 + 2*i].hasChanged_ = true;
+              halfAxes_[1 + 2*i].absVal_ = -((float)mousePosition_[i])/1024 * mouseSensitivity_;
+              halfAxes_[0 + 2*i].absVal_ =  0.0f;
+            }
+            else
+              halfAxes_[0 + 2*i].absVal_ =  ((float)mousePosition_[i])/1024 * mouseSensitivity_;
+          }
+          else
+          {
+            mousePosition_[i] += rel[i];
+            halfAxes_[1 + 2*i].hasChanged_ = true;
+            if (mousePosition_[i] > 0)
+            {
+              halfAxes_[0 + 2*i].hasChanged_ = true;
+              halfAxes_[0 + 2*i].absVal_ =  ((float)mousePosition_[i])/1024 * mouseSensitivity_;
+              halfAxes_[1 + 2*i].absVal_ =  0.0f;
+            }
+            else
+              halfAxes_[1 + 2*i].absVal_ = -((float)mousePosition_[i])/1024 * mouseSensitivity_;
+          }
+          //COUT(3) << "half axis 0: " << halfAxes_[0].absVal_ << std::endl;
+          //COUT(3) << "half axis 1: " << halfAxes_[1].absVal_ << std::endl;
+          //COUT(3) << "half axis 2: " << halfAxes_[2].absVal_ << std::endl;
+          //COUT(3) << "half axis 3: " << halfAxes_[3].absVal_ << std::endl;
+
+          // relative
+          if (rel[i] > 0)
+            halfAxes_[0 + 2*i].relVal_ =  ((float)rel[i])/1024 * mouseSensitivity_;
+          else
+            halfAxes_[1 + 2*i].relVal_ = -((float)rel[i])/1024 * mouseSensitivity_;
+        }
+      }
+    }
+    else
+    {
+      mouseRelative_[0] += rel_.x;
+      mouseRelative_[1] -= rel_.y;
+    }
+  }
+
+  /**
+    @brief Event handler for the mouseScrolled Event.
+    @param e Mouse state information
+  */
+  void KeyBinder::mouseScrolled(int abs, int rel)
+  {
+    //COUT(3) << mouseButtons_[8].name_ << "   " << abs << " | " << rel << std::endl;
+
+    if (rel > 0)
+      for (int i = 0; i < rel/120; i++)
+        mouseButtons_[8].execute(KeybindMode::OnPress, ((float)abs)/120.0f);
+    else
+      for (int i = 0; i < -rel/120; i++)
+        mouseButtons_[9].execute(KeybindMode::OnPress, ((float)abs)/120.0f);
+  }
+
+  void KeyBinder::joyStickAxisMoved(int joyStickID, int axis, int value)
+  {
+    // TODO: check whether 16 bit integer as general axis value is a good idea (works under windows)
+    int i = 8 + axis * 2;
+    if (value >= 0)
+    {
+      //if (value > 10000)
+      //{ CCOUT(3) << halfAxes_[i].name_ << std::endl; }
+
+      halfAxes_[i].absVal_ = ((float)value)/0x8000;
+      halfAxes_[i].relVal_ = ((float)value)/0x8000;
+      halfAxes_[i].hasChanged_ = true;
+      if (halfAxes_[i + 1].absVal_ > 0)
+      {
+        halfAxes_[i + 1].absVal_ = -0.0f;
+        halfAxes_[i + 1].relVal_ = -0.0f;
+        halfAxes_[i + 1].hasChanged_ = true;
+      }
+    }
+    else
+    {
+      //if (value < -10000)
+      //{ CCOUT(3) << halfAxes_[i + 1].name_ << std::endl; }
+
+      halfAxes_[i + 1].absVal_ = -((float)value)/0x8000;
+      halfAxes_[i + 1].relVal_ = -((float)value)/0x8000;
+      halfAxes_[i + 1].hasChanged_ = true;
+      if (halfAxes_[i].absVal_ > 0)
+      {
+        halfAxes_[i].absVal_ = -0.0f;
+        halfAxes_[i].relVal_ = -0.0f;
+        halfAxes_[i].hasChanged_ = true;
+      }
+    }
+  }
+
+
+  // ###############################
+  // #####     KeyDetector     #####
+  // ###############################
+
+  /**
+    @brief Constructor
+  */
+  KeyDetector::KeyDetector()
+  {
+    RegisterObject(KeyDetector);
+  }
+
+  /**
+    @brief Destructor
+  */
+  KeyDetector::~KeyDetector()
+  {
+  }
+
+  /**
+    @brief Loads the key and button bindings.
+    @return True if loading succeeded.
+  */
+  void KeyDetector::loadBindings()
+  {
+    clearBindings();
+    setConfigValues();
+  }
+
+  /**
+    @brief Loader for the key bindings, managed by config values.
+  */
+  void KeyDetector::setConfigValues()
+  {
+    // keys
+    for (unsigned int i = 0; i < nKeys_s; i++)
+      readTrigger(keys_[i]);
+    // mouse buttons
+    for (unsigned int i = 0; i < nMouseButtons_s; i++)
+      readTrigger(mouseButtons_[i]);
+    // joy stick buttons
+    for (unsigned int i = 0; i < nJoyStickButtons_s; i++)
+      readTrigger(joyStickButtons_[i]);
+    // half axes
+    for (unsigned int i = 0; i < nHalfAxes_s; i++)
+      readTrigger(halfAxes_[i]);
+  }
+
+  void KeyDetector::readTrigger(Button& button)
+  {
+    // binding has changed
+    button.parse(paramCommandBuffer_);
+    SimpleCommand* cmd = new SimpleCommand();
+    cmd->evaluation_ = CommandExecutor::evaluate("storeKeyStroke " + button.name_);
+    button.commands_[KeybindMode::OnPress] = new BaseCommand*[1];
+    button.commands_[KeybindMode::OnPress][0] = cmd;
+    button.nCommands_[KeybindMode::OnPress] = 1;
+  }
+}
Index: code/branches/network/src/core/KeyBinder.h
===================================================================
--- code/branches/network/src/core/KeyBinder.h	(revision 1413)
+++ code/branches/network/src/core/KeyBinder.h	(revision 1413)
@@ -0,0 +1,244 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ @file
+ @brief Different definitions of input processing.
+ */
+
+#ifndef _KeyBinder_H__
+#define _KeyBinder_H__
+
+#include "CorePrereqs.h"
+
+#include <string>
+#include <vector>
+
+#include "ois/OIS.h"
+#include "util/Math.h"
+#include "OrxonoxClass.h"
+#include "CommandExecutor.h"
+#include "InputInterfaces.h"
+
+namespace orxonox
+{
+  class _CoreExport BaseCommand
+  {
+  public:
+    virtual ~BaseCommand() { }
+    virtual bool execute(float abs = 1.0f, float rel = 1.0f) = 0;
+  };
+
+  class _CoreExport BufferedParamCommand
+  {
+  public:
+    BufferedParamCommand() : value_(0.0f), nValuesAdded_(0), paramIndex_(-1) { }
+    bool execute();
+
+    float value_;
+    unsigned int nValuesAdded_;
+    int paramIndex_;
+    CommandEvaluation evaluation_;
+  };
+
+  class _CoreExport SimpleCommand : public BaseCommand
+  {
+  public:
+    bool execute(float abs = 1.0f, float rel = 1.0f);
+
+    CommandEvaluation evaluation_;
+  };
+
+  class _CoreExport ParamCommand : public BaseCommand
+  {
+  public:
+    ParamCommand() : bRelative_(false), paramModifier_(1.0f), paramCommand_(0) { }
+    bool execute(float abs = 1.0f, float rel = 1.0f);
+
+    bool bRelative_;
+    float paramModifier_;
+    BufferedParamCommand* paramCommand_;
+  };
+
+  class _CoreExport Button
+  {
+  public:
+    Button() { nCommands_[0]=0; nCommands_[1]=0; nCommands_[2]=0; clear(); }
+    virtual ~Button() { clear(); }
+    virtual void clear();
+    virtual bool addParamCommand(ParamCommand* command) { return false; }
+    void parse(std::vector<BufferedParamCommand*>& paramCommandBuffer);
+    bool execute(KeybindMode::Enum mode, float abs = 1.0f, float rel = 1.0f);
+
+    //! The configured string value
+    std::string bindingString_;
+    //! Name of the trigger as strings
+    std::string name_;
+    //! Basic commands for OnPress, OnHold and OnRelease
+    BaseCommand** commands_[3];
+    //! Number of basic commands
+    unsigned int nCommands_[3];
+    //! Says how much it takes for an analog axis to trigger a button
+    //! Note: This variable is here to have only one parse() function.
+    float buttonThreshold_;
+  };
+
+
+  class _CoreExport HalfAxis : public Button
+  {
+  public:
+    HalfAxis() : relVal_(0.0f), absVal_(0.0f), paramCommands_(0), nParamCommands_(0),
+                 wasDown_(false), hasChanged_(false) { }
+    using Button::execute;
+    bool execute();
+    //bool execute(KeybindMode::Enum mode) { return Button::execute(mode); }
+    bool addParamCommand(ParamCommand* command);
+    void clear();
+
+    // axis related
+    float relVal_;
+    float absVal_;
+    ParamCommand** paramCommands_;
+    unsigned int nParamCommands_;
+
+    // button related
+    bool wasDown_;
+    bool hasChanged_;
+  };
+
+
+  /**
+    @brief Handles mouse, keyboard and joy stick input while in the actual game mode.
+           Manages the key bindings.
+  */
+  class _CoreExport KeyBinder : public KeyHandler, public MouseHandler, public JoyStickHandler, public OrxonoxClass
+  {
+  public:
+    KeyBinder ();
+    virtual ~KeyBinder();
+
+    void loadBindings();
+    void clearBindings();
+    void setConfigValues();
+
+  protected: // functions
+    void tickInput(float dt, const HandlerState& state);
+
+    void readTrigger(Button& button);
+
+    void keyPressed (const KeyEvent& evt);
+    void keyReleased(const KeyEvent& evt);
+    void keyHeld    (const KeyEvent& evt);
+
+    void mouseButtonPressed (MouseButton::Enum id);
+    void mouseButtonReleased(MouseButton::Enum id);
+    void mouseButtonHeld    (MouseButton::Enum id);
+    void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
+    void mouseScrolled      (int abs, int rel);
+
+    void joyStickButtonPressed (int joyStickID, int button);
+    void joyStickButtonReleased(int joyStickID, int button);
+    void joyStickButtonHeld    (int joyStickID, int button);
+    void joyStickAxisMoved     (int joyStickID, int axis, int value);
+
+  protected: // variables
+    //! denotes the number of different keys there are in OIS.
+    static const unsigned int nKeys_s = 0xEE;
+    //! Actual key bindings as bundle for Press, Hold and Release
+    Button keys_ [nKeys_s];
+
+    //! denotes the number of different mouse buttons there are in OIS.
+    static const unsigned int nMouseButtons_s = 8 + 2*2; // 8 buttons and 2 scroll wheels
+    //! Actual key bindings as bundle for Press, Hold and Release
+    Button mouseButtons_ [nMouseButtons_s];
+
+    //! denotes the number of different joy stick buttons there are in OIS.
+    static const unsigned int nJoyStickButtons_s = 32 + 4 * 4; // 32 buttons and 4 POVs with 4 buttons
+    //! Actual key bindings as bundle for Press, Hold and Release
+    Button joyStickButtons_ [nJoyStickButtons_s];
+
+    //! denotes the number of half axes (every axis twice) there can be.
+    static const unsigned int nHalfAxes_s = 56;
+    /**
+    * Array with all the half axes for mouse and joy sticks.
+    * Keep in mind that the positions are fixed and that the first entry is the
+    * positive one and the second is negative.
+    * Sequence is as follows:
+    *  0 -  3: Mouse x and y
+    *  4 -  7: empty
+    *  8 - 23: joy stick (slider) axes 1 to 8
+    * 24 - 55: joy stick axes 1 - 16
+    */
+    HalfAxis halfAxes_[nHalfAxes_s];
+
+    /**
+    * Commands that have additional parameters (axes) are executed at the end of
+    * the tick() so that all values can be buffered for single execution.
+    */
+    std::vector<BufferedParamCommand*> paramCommandBuffer_;
+
+    //! Keeps track of the absolute mouse value (incl. scroll wheel)
+    int mousePosition_[2];
+    //! Used to derive mouse input if requested
+    int mouseRelative_[2];
+    float deriveTime_;
+
+    //##### ConfigValues #####
+    //! Threshold for analog triggers until which the state is 0.
+    float analogThreshold_;
+    //! Threshold for analog triggers until which the button is not pressed.
+    float buttonThreshold_;
+    //! Derive mouse input for absolute values?
+    bool bDeriveMouseInput_;
+    //! Accuracy of the mouse input deriver. The higher the more precise, but laggier.
+    float derivePeriod_;
+    //! mouse sensitivity
+    float mouseSensitivity_;
+    //! mouse sensitivity if mouse input is derived
+    float mouseSensitivityDerived_;
+    //! default ini file for the keybindings
+    std::string keybindingsDefault_;
+  };
+
+
+  class _CoreExport KeyDetector : public KeyBinder
+  {
+  public:
+    KeyDetector();
+    ~KeyDetector();
+    void loadBindings();
+    void setConfigValues();
+  protected:
+    void readTrigger(Button& button);
+  };
+}
+
+
+
+
+#endif /* _KeyBinder_H__ */
Index: code/branches/network/src/orxonox/Orxonox.cc
===================================================================
--- code/branches/network/src/orxonox/Orxonox.cc	(revision 1412)
+++ code/branches/network/src/orxonox/Orxonox.cc	(revision 1413)
@@ -367,5 +367,5 @@
     ib->registerListener(orxonoxConsole_, &InGameConsole::execute, '\r', false);
     ib->registerListener(orxonoxConsole_, &InGameConsole::hintandcomplete, '\t', true);
-    ib->registerListener(orxonoxConsole_, &InGameConsole::clear, '�', true);
+    //ib->registerListener(orxonoxConsole_, &InGameConsole::clear, '§', true);
     ib->registerListener(orxonoxConsole_, &InGameConsole::removeLast, '\b', true);
     ib->registerListener(orxonoxConsole_, &InGameConsole::exit, (char)0x1B, true);
@@ -517,5 +517,5 @@
       // again, just to be sure ogre works fine
       ogreRoot._fireFrameEnded(evt);
-      //msleep(100);
+      //msleep(50);
 	  }
 
Index: code/branches/network/src/orxonox/objects/SpaceShip.cc
===================================================================
--- code/branches/network/src/orxonox/objects/SpaceShip.cc	(revision 1412)
+++ code/branches/network/src/orxonox/objects/SpaceShip.cc	(revision 1413)
@@ -482,5 +482,4 @@
     {
         SpaceShip* this_ = getLocalShip();
-        COUT(3) << val << std::endl;
         this_->acceleration_.x = this_->translationAcceleration_ * val;
     }
Index: code/branches/network/visual_studio/vc8/core.vcproj
===================================================================
--- code/branches/network/visual_studio/vc8/core.vcproj	(revision 1412)
+++ code/branches/network/visual_studio/vc8/core.vcproj	(revision 1413)
@@ -197,9 +197,9 @@
 			</File>
 			<File
-				RelativePath="..\..\src\core\InputHandler.cc"
-				>
-			</File>
-			<File
 				RelativePath="..\..\src\core\InputManager.cc"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\core\KeyBinder.cc"
 				>
 			</File>
@@ -347,8 +347,4 @@
 			</File>
 			<File
-				RelativePath="..\..\src\core\InputHandler.h"
-				>
-			</File>
-			<File
 				RelativePath="..\..\src\core\InputInterfaces.h"
 				>
@@ -360,4 +356,8 @@
 			<File
 				RelativePath="..\..\src\core\Iterator.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\core\KeyBinder.h"
 				>
 			</File>
