Index: code/branches/gui/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSGraphics.cc	(revision 2874)
+++ code/branches/gui/src/orxonox/gamestates/GSGraphics.cc	(revision 2875)
@@ -23,6 +23,11 @@
  *      Reto Grieder
  *   Co-authors:
- *      ...
- *
+ *      Benjamin Knecht
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of Graphics GameState class.
  */
 
@@ -71,8 +76,28 @@
     }
 
+    /**
+    @brief
+        this function does nothing
+
+        Indeed. Here goes nothing.
+    */
     void GSGraphics::setConfigValues()
     {
     }
 
+    /**
+    @brief
+        This function is called when we enter this game state.
+
+        Since graphics is very important for our game this function does quite a lot:
+        \li starts graphics manager
+        \li loads debug overlay
+        \li manages render window
+        \li creates input manager
+        \li loads master key bindings
+        \li loads ingame console
+        \li loads GUI interface (GUIManager)
+        \li creates console command to toggle GUI
+    */
     void GSGraphics::activate()
     {
@@ -90,12 +115,14 @@
         Loader::open(debugOverlay_);
 
-        // Calls the InputManager which sets up the input devices.
         // The render window width and height are used to set up the mouse movement.
-        inputManager_ = new InputManager();
         size_t windowHnd = 0;
         Ogre::RenderWindow* renderWindow = GraphicsManager::getInstance().getRenderWindow();
         renderWindow->getCustomAttribute("WINDOW", &windowHnd);
+
+        // Calls the InputManager which sets up the input devices.
+        inputManager_ = new InputManager();
         inputManager_->initialise(windowHnd, renderWindow->getWidth(), renderWindow->getHeight(), true);
 
+        // load master key bindings
         masterInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("master", true);
         masterKeyBinder_ = new KeyBinder();
@@ -111,4 +138,5 @@
         guiManager_->initialise(renderWindow);
 
+        // add console command to toggle GUI
         FunctorMember<GSGraphics>* functor = createFunctor(&GSGraphics::toggleGUI);
         functor->setObject(this);
@@ -116,8 +144,14 @@
         CommandExecutor::addConsoleCommandShortcut(this->ccToggleGUI_);
 
-
+        // enable master input
         InputManager::getInstance().requestEnterState("master");
     }
 
+    /**
+    @brief
+        This function is called when the game state is left
+
+        Created references, input states and console commands are deleted.
+    */
     void GSGraphics::deactivate()
     {
@@ -147,4 +181,11 @@
     }
 
+    /**
+    @brief
+        Toggles the visibility of the current GUI
+
+        This function just executes a Lua function in the main script of the GUI by accessing the GUIManager.
+        For more details on this function check out the Lua code.
+    */
     void GSGraphics::toggleGUI()
     {
Index: code/branches/gui/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSGraphics.h	(revision 2874)
+++ code/branches/gui/src/orxonox/gamestates/GSGraphics.h	(revision 2875)
@@ -23,7 +23,12 @@
  *      Reto Grieder
  *   Co-authors:
- *      ...
+ *      Benjamin Knecht (documentation)
  *
  */
+
+ /**
+    @file
+    @brief Declaration of the Graphics GameState class.
+  */
 
 #ifndef _GSGraphics_H__
@@ -36,4 +41,11 @@
 namespace orxonox
 {
+    /**
+    @class GSGraphics
+    @brief
+        Game state used when displaying graphics of any kind
+
+        This game state is only left out if we start a dedicated server where no graphics are present.
+    */
     class _OrxonoxExport GSGraphics : public GameState, public WindowEventListener
     {
@@ -55,13 +67,13 @@
 
         // managed singletons
-        InputManager*         inputManager_;
+        InputManager*         inputManager_;        //!< Reference to input management
         InGameConsole*        console_;
-        GUIManager*           guiManager_;
-        GraphicsManager*      graphicsManager_;       //!< Interface to Ogre
+        GUIManager*           guiManager_;          //!< Interface to GUI
+        GraphicsManager*      graphicsManager_;     //!< Interface to Ogre
 
-        KeyBinder*            masterKeyBinder_;
-        SimpleInputState*     masterInputState_;
+        KeyBinder*            masterKeyBinder_;     //!< Key binder for master key bindings
+        SimpleInputState*     masterInputState_;    //!< Special input state for master input
         XMLFile*              debugOverlay_;
-        ConsoleCommand*       ccToggleGUI_;
+        ConsoleCommand*       ccToggleGUI_;         //!< Console command to toggle GUI
     };
 }
Index: code/branches/gui/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSLevel.cc	(revision 2874)
+++ code/branches/gui/src/orxonox/gamestates/GSLevel.cc	(revision 2875)
@@ -24,4 +24,5 @@
  *   Co-authors:
  *      Fabian 'x3n' Landau
+ *      Benjamin Knecht
  *
  */
@@ -56,5 +57,5 @@
 
     SetCommandLineArgument(level, "presentation.oxw").shortcut("l");
-    SetConsoleCommand(GSLevel, showIngameGUI, true).keybindMode(KeybindMode::OnPress).keybindMode(KeybindMode::OnRelease);
+    SetConsoleCommand(GSLevel, showIngameGUI, true);
 
     GSLevel::GSLevel(const std::string& name)
Index: code/branches/gui/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSLevel.h	(revision 2874)
+++ code/branches/gui/src/orxonox/gamestates/GSLevel.h	(revision 2875)
@@ -23,5 +23,5 @@
  *      Reto Grieder
  *   Co-authors:
- *      ...
+ *      Benjamin Knecht
  *
  */
@@ -64,7 +64,7 @@
         Radar*                radar_;                   //!< represents the Radar (not the HUD part)
         XMLFile*              startFile_;               //!< current hard coded default level
-        CameraManager*        cameraManager_;
-        LevelManager*         levelManager_;
-        PlayerManager*        playerManager_;
+        CameraManager*        cameraManager_;           //!< camera manager for this level
+        LevelManager*         levelManager_;            //!< global level manager
+        PlayerManager*        playerManager_;           //!< player manager for this level
 
         //##### ConfigValues #####
Index: code/branches/gui/src/orxonox/gui/GUIManager.cc
===================================================================
--- code/branches/gui/src/orxonox/gui/GUIManager.cc	(revision 2874)
+++ code/branches/gui/src/orxonox/gui/GUIManager.cc	(revision 2875)
@@ -22,6 +22,7 @@
  *   Author:
  *      Reto Grieder
+ *      Benjamin Knecht
  *   Co-authors:
- *      Benjamin Knecht
+ *
  *
  */
@@ -75,4 +76,10 @@
     }
 
+    /**
+    @brief
+        Deconstructor of the GUIManager
+
+        Basically shuts down CEGUI and destroys the Lua engine and afterwards the interface to the Ogre engine.
+    */
     GUIManager::~GUIManager()
     {
@@ -96,4 +103,18 @@
     }
 
+    /**
+    @brief
+        Initialises the GUIManager by starting up CEGUI
+    @param renderWindow
+        Ogre's render window. Without this, the GUI cannot be displayed.
+    @return true if success, otherwise false
+
+        Before this call the GUIManager won't do anything, but can be accessed.
+
+        Creates the interface to Ogre, sets up the CEGUI renderer and the Lua script module together with the Lua engine.
+        The log is set up and connected to the CEGUILogger.
+        After Lua setup tolua++-elements are linked to Lua-state to give Lua access to C++-code.
+        Finally initial Lua code is executed (maybe we can do this with the CEGUI startup script automatically).
+    */
     bool GUIManager::initialise(Ogre::RenderWindow* renderWindow)
     {
@@ -151,9 +172,22 @@
     }
 
+    /**
+    @brief
+        Calls main Lua script
+    @todo
+        Replace loadGUI.lua with loadGUI_2.lua after merging this back to trunk.
+        However CEGUI is able to execute a startup script. We could maybe put this call in this startup code.
+
+        This function calls the main Lua script for our GUI.
+
+        Additionally we set the datapath variable in Lua. This is needed so Lua can access the data used for the GUI.
+    */
     void GUIManager::loadLuaCode()
     {
         try
         {
+            // call main Lua script
             this->scriptModule_->executeScriptFile("loadGUI_2.lua", "GUI");
+            // set datapath for GUI data
             lua_pushfstring(this->scriptModule_->getLuaState(), Core::getMediaPathString().c_str());
             lua_setglobal(this->scriptModule_->getLuaState(), "datapath");
@@ -170,4 +204,14 @@
     }
 
+    /**
+    @brief
+        used to tick the GUI
+    @param time
+        clock which provides time value for the GUI System
+
+        Ticking the GUI means updating it with a certain regularity.
+        The elapsed time since the last call is given in the time value provided by the clock.
+        This time value is then used to provide a fluent animation of the GUI.
+    */
     void GUIManager::update(const Clock& time)
     {
@@ -176,4 +220,12 @@
     }
 
+    /**
+    @brief
+        Executes Lua code
+    @param str
+        reference to string object holding the Lua code which is to be executed
+
+        This function gives total access to the GUI. You can execute ANY Lua code here.
+    */
     void GUIManager::executeCode(const std::string& str)
     {
@@ -181,4 +233,14 @@
     }
 
+    /**
+    @brief
+        Tells the GUIManager which SceneManager to use
+    @param camera
+        The current camera on which the GUI should be displayed on.
+
+        In fact the GUIManager needs the SceneManager and not the Camera to display the GUI.
+        This means the GUI is not bound to a camera but rather to the SceneManager.
+        Hidding the GUI when needed can therefore not be solved by just NOT setting the current camera.
+    */
     void GUIManager::setCamera(Ogre::Camera* camera)
     {
@@ -186,4 +248,13 @@
     }
 
+    /**
+    @brief
+        Debug function to give CEGUI the possibility to output on our console
+    @param
+        String to be displaed in CEGUI's name
+
+        This function should be removed as it only provides a quick (and dirty) possibility to access the output on the console.
+        CEGUI's output should be put into the cegui.log using the CEGUI Logger.
+    */
     void GUIManager::testOutput(std::string& str)
     {
@@ -191,4 +262,13 @@
     }
 
+    /**
+    @brief
+        Displays specified GUI on screen
+    @param name
+        The name of the GUI
+
+        The function executes the Lua function with the same name in case the GUIManager is ready.
+        For more details check out loadGUI_2.lua where the function presides.
+    */
     void GUIManager::showGUI(const std::string& name)
     {
@@ -215,4 +295,13 @@
     }
 
+    /**
+    @brief
+        Function receiving a mouse button pressed event.
+    @param id
+        ID of the mouse button which got pressed
+
+        This function is inherited by MouseHandler and injects the event into CEGUI.
+        It is for CEGUI to process the event.
+    */
     void GUIManager::mouseButtonPressed(MouseButtonCode::ByEnum id)
     {
@@ -228,4 +317,13 @@
     }
 
+    /**
+    @brief
+        Function receiving a mouse button released event.
+    @param id
+        ID of the mouse button which got released
+
+        This function is inherited by MouseHandler and injects the event into CEGUI.
+        It is for CEGUI to process the event.
+    */
     void GUIManager::mouseButtonReleased(MouseButtonCode::ByEnum id)
     {
@@ -241,5 +339,14 @@
     }
 
-
+    /**
+    @brief
+        converts mouse event code to CEGUI event code
+    @param button
+        code of the mouse button as we use it in Orxonox
+    @return
+        code of the mouse button as it is used by CEGUI
+
+        Simple convertion from mouse event code in Orxonox to the one used in CEGUI.
+     */
     inline CEGUI::MouseButton GUIManager::convertButton(MouseButtonCode::ByEnum button)
     {
Index: code/branches/gui/src/orxonox/gui/GUIManager.h
===================================================================
--- code/branches/gui/src/orxonox/gui/GUIManager.h	(revision 2874)
+++ code/branches/gui/src/orxonox/gui/GUIManager.h	(revision 2875)
@@ -23,5 +23,5 @@
  *      Reto Grieder
  *   Co-authors:
- *      ...
+ *      Benjamin Knecht
  *
  */
@@ -49,6 +49,13 @@
 {
     /**
+    @class GUIManager
     @brief
-        Provides a simple interface to CEGUI with tolua methods and console commands
+        Provides a simple interface to CEGUI with tolua methods and console commands. It also acts as a key and mouse handler.
+
+        The GUIManager is a singleton and can be called anywhere when access on the GUI is needed.
+        Creation of the GUIManager is therefore not possible and the cunstructor is private.
+
+        Since the GUI needs user input, the GUIManager implements the functions needed to act as a key and/or mouse handler.
+        Those input events are then injected into CEGUI in Lua.
     */
     class _OrxonoxExport GUIManager
@@ -59,9 +66,13 @@
 // tolua_end
     public:
+        /**
+        @enum State
+            The current state of the GUIManager. There should maybe be more (or we can omit this totally).
+        */
         enum State
         {
-            Uninitialised,
-            Ready,
-            OnDisplay
+            Uninitialised,  //!< Initial state of the GUIManager
+            Ready,          //!< State after initialisation if ready
+            OnDisplay       //!< State if GUI is displayed
         };
 
@@ -84,42 +95,41 @@
 
     private:
-        GUIManager(const GUIManager& instance);
+        GUIManager(const GUIManager& instance);                 //!< private constructor (this is a singleton class)
 
         void loadLuaCode();
 
+        // keyHandler functions
         void keyPressed (const KeyEvent& evt)
-        { guiSystem_->injectKeyDown(evt.key); guiSystem_->injectChar(evt.text); }
+            { guiSystem_->injectKeyDown(evt.key); guiSystem_->injectChar(evt.text); }
         void keyReleased(const KeyEvent& evt)
-        { guiSystem_->injectKeyUp(evt.key); }
-        void keyHeld    (const KeyEvent& evt)
-        { }
+            { guiSystem_->injectKeyUp(evt.key); }
+        void keyHeld    (const KeyEvent& evt) { }
 
+        // mouseHandler functions
         void mouseButtonPressed (MouseButtonCode::ByEnum id);
         void mouseButtonReleased(MouseButtonCode::ByEnum id);
-        void mouseButtonHeld    (MouseButtonCode::ByEnum id)
-        { }
+        void mouseButtonHeld    (MouseButtonCode::ByEnum id) { }
         void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
-        { guiSystem_->injectMouseMove(rel.x, rel.y); }
+            { guiSystem_->injectMouseMove(rel.x, rel.y); }
         void mouseScrolled      (int abs, int rel)
-        { guiSystem_->injectMouseWheelChange(rel);}
+            { guiSystem_->injectMouseWheelChange(rel);}
 
-        void updateInput(float dt) { }
-        void updateKey(float dt) { }
-        void updateMouse(float dt) { }
-
-        Ogre::RenderWindow*       renderWindow_;
-        CEGUI::OgreCEGUIRenderer* guiRenderer_;
-        CEGUI::ResourceProvider*  resourceProvider_;
-        CEGUI::LuaScriptModule*   scriptModule_;
-        CEGUI::DefaultLogger*     ceguiLogger_;
-        CEGUI::System*            guiSystem_;
-        CEGUI::Imageset*          backgroundImage_;
-        lua_State*                luaState_;
-
-        State state_;
+        void updateInput(float dt)  { }
+        void updateKey  (float dt)  { }
+        void updateMouse(float dt)  { }
 
         static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button);
 
-        static GUIManager*        singletonRef_s;
+        Ogre::RenderWindow*         renderWindow_;      //!< Ogre's render window to give CEGUI access to it
+        CEGUI::OgreCEGUIRenderer*   guiRenderer_;       //!< CEGUI's interface to the Ogre Engine
+        CEGUI::ResourceProvider*    resourceProvider_;  //!< CEGUI's resource provider
+        CEGUI::LuaScriptModule*     scriptModule_;      //!< CEGUI's script module to use Lua
+        CEGUI::DefaultLogger*       ceguiLogger_;       //!< CEGUI's logger to be able to log CEGUI errors in our log
+        CEGUI::System*              guiSystem_;         //!< CEGUI's main system
+        lua_State*                  luaState_;          //!< Lua state, access point to the Lua engine
+
+        State                       state_;             //!< reflects state of the GUIManager
+
+        static GUIManager*          singletonRef_s;     //!< Singleton reference to GUIManager
     }; // tolua_export
 } // tolua_export
