Index: orxonox/trunk/src/util/event/event.h
===================================================================
--- orxonox/trunk/src/util/event/event.h	(revision 4350)
+++ orxonox/trunk/src/util/event/event.h	(revision 4352)
@@ -8,7 +8,7 @@
 #define _EVENT_H
 
-#define CMD_LENGHT 16
 
 #include "base_object.h"
+#include "event_def.h"
 
 
Index: orxonox/trunk/src/util/event/event_handler.cc
===================================================================
--- orxonox/trunk/src/util/event/event_handler.cc	(revision 4350)
+++ orxonox/trunk/src/util/event/event_handler.cc	(revision 4352)
@@ -19,4 +19,7 @@
 #include "event_listener.h"
 
+#include "ini_parser.h"
+#include "keynames.h"
+
 #include "SDL_keysym.h"
 
@@ -29,7 +32,9 @@
 EventHandler::EventHandler () 
 {
-   this->setClassID(CL_EVENT_HANDLER, "EventHandler"); 
+  this->setClassID(CL_EVENT_HANDLER, "EventHandler"); 
 
-   this->listeners = new EventListener*[SDLK_LAST];
+  this->listeners = new EventListener**[ES_NUMBER];
+  for(int i = 0; i < ES_NUMBER; ++i)
+    this->listeners[i] = new EventListener*[SDLK_LAST];
 }
 
@@ -56,4 +61,108 @@
 {
   EventHandler::singletonRef = NULL;
+}
 
+
+/**
+   \brief loads new key bindings from a file
+   \param filename: The path and name of the file to load the bindings from
+*/
+void EventHandler::loadKeyBindings (const char* fileName)
+{
+  FILE* stream;
+  
+  PRINTF(4)("Loading key bindings from %s\n", fileName);
+  
+  // remove old bindings if present
+  if( this->keyAliases != NULL)
+    {
+      free (this->keyAliases);
+      this->keyAliases = NULL;
+    }
+  
+  // create parser
+  IniParser parser(fileName);
+  if( parser.getSection (CONFIG_SECTION_PLAYER "1") == -1)
+    {
+      PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1 in %s\n", fileName);
+      return;
+    }
+  // allocate empty lookup table
+  this->keyAliases = (KeyBindings*) calloc (1, sizeof (KeyBindings));
+  
+  char namebuf[256];
+  char valuebuf[256];
+  memset (namebuf, 0, 256);
+  memset (valuebuf, 0, 256);
+  int* index;
+  
+  while( parser.nextVar (namebuf, valuebuf) != -1)
+    {
+      //index = nameToIndex (valuebuf);
+      int c;
+      if( (c = keynameToSDLK (valuebuf)) != -1)
+	{
+	  index[1] = c; index[0] = 0;
+	}
+      if( (c = buttonnameToSDLB (valuebuf)) != -1)
+	{
+	  index[1] = c; index[0] = 1;
+	}
+
+      switch( index[0])
+	{
+	case 0:
+	  PRINTF(4)("Key binding %d(%s) set to %s\n", index[1], SDLKToKeyname( index[1]), namebuf);
+	  strcpy (this->keyAliases->keys[index[1]], namebuf);
+	  break;
+	case 1:
+	  PRINTF(4)("Button binding %d(%s) set to %s\n", index[1], SDLBToButtonname( index[1]), namebuf);
+	  strcpy (this->keyAliases->buttons[index[1]], namebuf);
+	  break;
+	default:
+	  break;
+	}
+      memset (namebuf, 0, 256);
+      memset (valuebuf, 0, 256);
+    }
+
+
+  // PARSE MISC SECTION
+  if( parser.getSection (CONFIG_SECTION_MISC_KEYS) == -1)
+    {
+      PRINTF(1)("Could not find key bindings in %s\n", fileName);
+      return;
+    }
+
+  while( parser.nextVar (namebuf, valuebuf) != -1)
+    {
+      //index = nameToIndex (valuebuf);     
+      int c;
+      if( (c = keynameToSDLK (valuebuf)) != -1)
+	{
+	  index[1] = c; index[0] = 0;
+	}
+      if( (c = buttonnameToSDLB (valuebuf)) != -1)
+	{
+	  index[1] = c; index[0] = 1;
+	}
+
+
+      switch( index[0])
+	{
+	case 0:
+	  PRINTF(4)("Key binding %d(%s) set to %s\n", index[1], SDLKToKeyname( index[1]), namebuf);
+	  strcpy (keyAliases->keys[index[1]], namebuf);
+	  break;
+	case 1:
+	  PRINTF(4)("Button binding %d(%s) set to %s\n", index[1], SDLBToButtonname( index[1]), namebuf);
+	  strcpy (keyAliases->buttons[index[1]], namebuf);
+	  break;
+	default:
+	  break;
+	}
+      memset (namebuf, 0, 256);
+      memset (valuebuf, 0, 256);
+    }
 }
+
Index: orxonox/trunk/src/util/event/event_handler.h
===================================================================
--- orxonox/trunk/src/util/event/event_handler.h	(revision 4350)
+++ orxonox/trunk/src/util/event/event_handler.h	(revision 4352)
@@ -9,7 +9,13 @@
 
 #include "base_object.h"
+#include "event_def.h"
 
 class EventListener;
 template<class T> class tList;
+
+
+#define N_STD_KEYS SDLK_LAST
+#define N_BUTTONS 6
+#define DEFAULT_KEYBIND_FILE "~/.orxonox/orxonox.conf"
 
 typedef enum elState
@@ -21,4 +27,15 @@
     ES_NUMBER,
   };
+
+//! Key aliasing structure
+/**
+   This structure contains the key aliasing information, e.g. the command strings that
+   have been bound to the keys.
+*/
+typedef struct
+{
+  char keys[N_STD_KEYS][CMD_LENGHT];
+  char buttons[N_BUTTONS][CMD_LENGHT];
+} KeyBindings;
 
 
@@ -39,10 +56,13 @@
 
   void tick(float t);
+  void process();
 
  private:
   EventHandler(void);
+
   static EventHandler* singletonRef;
 
-  EventListener** listeners;                         //!< a list of registered listeners
+  KeyBindings* keyAliases;
+  EventListener*** listeners;                         //!< a list of registered listeners
   
 };
Index: orxonox/trunk/src/util/event/event_listener.h
===================================================================
--- orxonox/trunk/src/util/event/event_listener.h	(revision 4350)
+++ orxonox/trunk/src/util/event/event_listener.h	(revision 4352)
@@ -9,4 +9,5 @@
 
 #include "base_object.h"
+#include "event_def.h"
 
 
