Index: code/branches/gui/src/orxonox/GraphicsEngine.cc
===================================================================
--- code/branches/gui/src/orxonox/GraphicsEngine.cc	(revision 1639)
+++ code/branches/gui/src/orxonox/GraphicsEngine.cc	(revision 1640)
@@ -85,5 +85,5 @@
         , renderWindow_(0)
         , levelSceneManager_(0)
-        , levelViewport_(0)
+        , viewport_(0)
     {
         RegisterObject(GraphicsEngine);
@@ -308,5 +308,5 @@
         // The GUI uses its own one to be able to render on top of everything.
         // That explains why the Z order here is only 1 and not 0 (top most)
-        this->levelViewport_ = this->renderWindow_->addViewport(0, 1);
+        this->viewport_ = this->renderWindow_->addViewport(0, 1);
 
         return true;
Index: code/branches/gui/src/orxonox/GraphicsEngine.h
===================================================================
--- code/branches/gui/src/orxonox/GraphicsEngine.h	(revision 1639)
+++ code/branches/gui/src/orxonox/GraphicsEngine.h	(revision 1640)
@@ -68,5 +68,5 @@
         Ogre::SceneManager* getLevelSceneManager() { return levelSceneManager_; }
 
-        Ogre::Viewport* getLevelViewport() { return this->levelViewport_; }
+        Ogre::Viewport* getViewport() { return this->viewport_; }
 
         // several window properties
@@ -107,5 +107,5 @@
         Ogre::RenderWindow* renderWindow_;          //!< the current render window
         Ogre::SceneManager* levelSceneManager_;     //!< scene manager of the game
-        Ogre::Viewport*     levelViewport_;         //!< default full size viewport for the level
+        Ogre::Viewport*     viewport_;              //!< default full size viewport
 
         // stats
Index: code/branches/gui/src/orxonox/Orxonox.cc
===================================================================
--- code/branches/gui/src/orxonox/Orxonox.cc	(revision 1639)
+++ code/branches/gui/src/orxonox/Orxonox.cc	(revision 1640)
@@ -250,4 +250,5 @@
                 ogre_->getWindowWidth(), ogre_->getWindowHeight(), true, true, true);
           KeyBinder* keyBinder = new KeyBinder();
+          keyBinder->loadBindings();
           InputManager::createSimpleInputState("game", 20)->setHandler(keyBinder);
 
@@ -277,6 +278,6 @@
         {
           // show main menu
-          //GraphicsEngine::getSingleton().createNewScene();
-          GUIManager::getInstance().showGUI("MainMenu", true);
+          GUIManager::getInstance().showGUI("MainMenu", 0);
+          GraphicsEngine::getSingleton().getViewport()->setCamera(GUIManager::getInstance().getCamera());
         }
     }
@@ -340,5 +341,8 @@
       
       if (success)
+      {
         InputManager::requestEnterState("game");
+        this->mode_ = mode;
+      }
 
       return success;
@@ -450,5 +454,6 @@
     unsigned long frameCount = 0;
     
-    const unsigned long refreshTime = debugRefreshTime_ * 1000000.0f;
+    const unsigned long refreshTime = 50000.0f;
+    //const unsigned long refreshTime = debugRefreshTime_ * 1000000.0f;
     unsigned long refreshStartTime = 0;
     unsigned long tickTime = 0;
@@ -458,6 +463,4 @@
     unsigned long timeBeforeTickOld = 0;
     unsigned long timeAfterTick = 0;
-
-    int sleepTime = 0;
 
     // TODO: Update time in seconds every 7 seconds to avoid any overflow (7 secs is very tight)
@@ -511,20 +514,8 @@
           GraphicsEngine::getSingleton().setAverageFramesPerSecond(avgFPS);
 
-          if (avgFPS > 60.0)
-            sleepTime++;
-          else
-            sleepTime--;
-          if (sleepTime < 0)
-              sleepTime = 0;
-
           oldFrameCount = frameCount;
           tickTime = 0;
           refreshStartTime = timeAfterTick;
         }
-
-        // do some sleeping when the frameRate is over 60
-        if (sleepTime > 0)
-          msleep(sleepTime);
-
 
         // don't forget to call _fireFrameStarted in ogre to make sure
Index: code/branches/gui/src/orxonox/gui/GUIManager.cc
===================================================================
--- code/branches/gui/src/orxonox/gui/GUIManager.cc	(revision 1639)
+++ code/branches/gui/src/orxonox/gui/GUIManager.cc	(revision 1640)
@@ -59,9 +59,9 @@
 
     GUIManager::GUIManager()
-        : emptySceneManager_(0)
-        , backgroundSceneManager_(0)
-        , emptyCamera_(0)
+        //: emptySceneManager_(0)
+        : backgroundSceneManager_(0)
+        //, emptyCamera_(0)
         , backgroundCamera_(0)
-        , viewport_(0)
+        //, viewport_(0)
         , renderWindow_(0)
         , guiRenderer_(0)
@@ -91,9 +91,9 @@
 
                 // Full screen viewport with Z order = 0 (top most). Don't yet feed a camera (so nothing gets rendered)
-                this->viewport_ = renderWindow_->addViewport(0, 3);
-                this->viewport_->setOverlaysEnabled(false);
-                this->viewport_->setShadowsEnabled(false);
-                this->viewport_->setSkiesEnabled(false);
-                this->viewport_->setClearEveryFrame(false);
+                //this->viewport_ = renderWindow_->addViewport(0, 3);
+                //this->viewport_->setOverlaysEnabled(false);
+                //this->viewport_->setShadowsEnabled(false);
+                //this->viewport_->setSkiesEnabled(false);
+                //this->viewport_->setClearEveryFrame(false);
 
                 // Note: No SceneManager specified yet
@@ -145,11 +145,11 @@
         // But in order to realise that, we also need a SceneManager with an empty scene,
         // because the SceneManager is responsible for the render queue.
-        this->emptySceneManager_ = Ogre::Root::getSingleton()
-            .createSceneManager(Ogre::ST_GENERIC, "GUI/EmptySceneManager");
+        //this->emptySceneManager_ = Ogre::Root::getSingleton()
+        //    .createSceneManager(Ogre::ST_GENERIC, "GUI/EmptySceneManager");
 
         // we also need a camera or we won't see anything at all.
         // The camera settings don't matter at all for an empty scene since the GUI
         // gets rendered on top of the screen rather than into the scene.
-        this->emptyCamera_ = this->emptySceneManager_->createCamera("GUI/EmptyCamera");
+        //this->emptyCamera_ = this->emptySceneManager_->createCamera("GUI/EmptyCamera");
 
         // Create another SceneManager that enables to display some 3D
@@ -171,5 +171,5 @@
     }
 
-    void GUIManager::showGUI(const std::string& name, bool showBackground)
+    void GUIManager::showGUI(const std::string& name, Ogre::SceneManager* sceneManager)// bool showBackground)
     {
         if (state_ != Uninitialised)
@@ -181,10 +181,10 @@
             try
             {
-                if (showBackground)
+                if (!sceneManager)
                 {
                     // currently, only an image is loaded. We could do 3D, see loadBackground.
-                    this->viewport_->setClearEveryFrame(true);
+                    //this->viewport_->setClearEveryFrame(true);
                     this->guiRenderer_->setTargetSceneManager(this->backgroundSceneManager_);
-                    this->viewport_->setCamera(this->backgroundCamera_);
+                    //this->viewport_->setCamera(this->backgroundCamera_);
 
                     lua_pushboolean(this->scriptModule_->getLuaState(), true);
@@ -193,7 +193,7 @@
                 else
                 {
-                    this->viewport_->setClearEveryFrame(false);
-                    this->guiRenderer_->setTargetSceneManager(this->emptySceneManager_);
-                    this->viewport_->setCamera(this->emptyCamera_);
+                    //this->viewport_->setClearEveryFrame(false);
+                    this->guiRenderer_->setTargetSceneManager(sceneManager);
+                    //this->viewport_->setCamera(this->emptyCamera_);
 
                     lua_pushboolean(this->scriptModule_->getLuaState(), false);
@@ -226,5 +226,6 @@
         if (this->state_ != OnDisplay)
             return;
-        this->viewport_->setCamera(0);
+        //this->viewport_->setCamera(0);
+        this->guiRenderer_->setTargetSceneManager(0);
         this->state_ = Ready;
         InputManager::requestLeaveState("gui");
Index: code/branches/gui/src/orxonox/gui/GUIManager.h
===================================================================
--- code/branches/gui/src/orxonox/gui/GUIManager.h	(revision 1639)
+++ code/branches/gui/src/orxonox/gui/GUIManager.h	(revision 1640)
@@ -70,11 +70,13 @@
         bool initialise();
         void tick(float dt);
-        void showGUI(const std::string& name, bool showBackground); // tolua_export
+        void showGUI(const std::string& name, Ogre::SceneManager* sceneManager);// bool showBackground); // tolua_export
         void _hideGUI(); // tolua_export
 
+        Ogre::Camera* getCamera() { return this->backgroundCamera_; }
+
         static GUIManager& getInstance(); // tolua_export
-        static void showGUI_s(const std::string& name, bool showBackground)
+        static void showGUI_s(const std::string& name, Ogre::SceneManager* sceneManager)//bool showBackground)
         {
-            getInstance().showGUI(name, showBackground);
+            getInstance().showGUI(name, sceneManager);
         }
 
@@ -104,9 +106,9 @@
         void loadScenes();
 
-        Ogre::SceneManager*       emptySceneManager_;
+        //Ogre::SceneManager*       emptySceneManager_;
         Ogre::SceneManager*       backgroundSceneManager_;
-        Ogre::Camera*             emptyCamera_;
+        //Ogre::Camera*             emptyCamera_;
         Ogre::Camera*             backgroundCamera_;
-        Ogre::Viewport*           viewport_;
+        //Ogre::Viewport*           viewport_;
         Ogre::RenderWindow*       renderWindow_;
         CEGUI::OgreCEGUIRenderer* guiRenderer_;
Index: code/branches/gui/src/orxonox/objects/CameraHandler.cc
===================================================================
--- code/branches/gui/src/orxonox/objects/CameraHandler.cc	(revision 1639)
+++ code/branches/gui/src/orxonox/objects/CameraHandler.cc	(revision 1640)
@@ -45,6 +45,6 @@
   {
     this->cam_ = GraphicsEngine::getSingleton().getLevelSceneManager()->createCamera("Cam");
-    GraphicsEngine::getSingleton().getLevelViewport()->setCamera(this->cam_);
-    GraphicsEngine::getSingleton().getRenderWindow()->addViewport(this->cam_, 2, 0.4, 0.4, 0.2, 0.2);
+    GraphicsEngine::getSingleton().getViewport()->setCamera(this->cam_);
+    //GraphicsEngine::getSingleton().getRenderWindow()->addViewport(this->cam_, 2, 0.4, 0.4, 0.2, 0.2);
     /*this->activeCamera_ = *ObjectList<Camera>::begin();
     this->activeCamera_->cam_ = this->cam_;*/
