Index: code/branches/gamestates2/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/gamestates2/src/libraries/core/GUIManager.cc	(revision 6736)
+++ code/branches/gamestates2/src/libraries/core/GUIManager.cc	(revision 6737)
@@ -42,4 +42,5 @@
 #include <CEGUISystem.h>
 #include <CEGUIWindow.h>
+#include <CEGUIWindowManager.h>
 #include <ogreceguirenderer/OgreCEGUIRenderer.h>
 
@@ -147,10 +148,19 @@
         guiSystem_->injectMousePosition((float)mousePosition.first, (float)mousePosition.second);
 
-        // Hide the mouse cursor unless playing in full screen mode
-        if (!GraphicsManager::getInstance().isFullScreen())
-            CEGUI::MouseCursor::getSingleton().hide();
-
-        // Initialise the basic Lua code
+        // Initialise the Lua framework and load the schemes
         this->luaState_->doFile("InitialiseGUI.lua");
+
+        // Create the root nodes
+        this->rootWindow_ = CEGUI::WindowManager::getSingleton().createWindow("MenuWidgets/StaticImage", "AbsoluteRootWindow");
+        this->rootWindow_->setProperty("FrameEnabled", "False");
+        this->hudRootWindow_ = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "HUDRootWindow");
+        this->menuRootWindow_ = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "MenuRootWindow");
+        // And connect them
+        CEGUI::System::getSingleton().setGUISheet(this->rootWindow_);
+        this->rootWindow_->addChildWindow(this->hudRootWindow_);
+        this->rootWindow_->addChildWindow(this->menuRootWindow_);
+
+        // Set up the sheet manager in the Lua framework
+        this->luaState_->doFile("SheetManager.lua");
     }
 
@@ -203,6 +213,4 @@
     @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)
@@ -217,5 +225,5 @@
     void GUIManager::loadGUI(const std::string& name)
     {
-        this->executeCode("loadGUI(\"" + name + "\")");
+        this->executeCode("loadSheet(\"" + name + "\")");
     }
 
@@ -292,7 +300,19 @@
     }
 
-    void GUIManager::setBackground(const std::string& name)
-    {
-        this->executeCode("setBackground(\"" + name + "\")");
+    void GUIManager::setBackgroundImage(const std::string& imageSet, const std::string imageName)
+    {
+        if (imageSet.empty() || imageName.empty())
+            this->setBackgroundImage("set: " + imageSet + " image: " + imageName);
+        else
+            this->setBackgroundImage("");
+    }
+
+    void GUIManager::setBackgroundImage(const std::string& image)
+    {
+        if (image.empty())
+            this->rootWindow_->setProperty("Alpha", "0.0");
+        else
+            this->rootWindow_->setProperty("Alpha", "1.0");
+        this->rootWindow_->setProperty("Image", image);
     }
 
Index: code/branches/gamestates2/src/libraries/core/GUIManager.h
===================================================================
--- code/branches/gamestates2/src/libraries/core/GUIManager.h	(revision 6736)
+++ code/branches/gamestates2/src/libraries/core/GUIManager.h	(revision 6737)
@@ -79,7 +79,14 @@
         static void hideGUI(const std::string& name);
         void keyESC();
-        void setBackground(const std::string& name);
+        void setBackgroundImage(const std::string& imageSet, const std::string imageName); // tolua_export
+        void setBackgroundImage(const std::string& image);
 
+        //! Creates a new InputState to be used with a GUI Sheet
         const std::string& createInputState(const std::string& name, TriBool::Value showCursor = TriBool::True, TriBool::Value useKeyboard = TriBool::True, bool bBlockJoyStick = false); // tolua_export
+
+        //! Returns the root window for all menu sheets
+        CEGUI::Window* getMenuRootWindow() { return this->menuRootWindow_; } // tolua_export
+        //! Returns the root window for all HUD sheets
+        CEGUI::Window* getHUDRootWindow() { return this->hudRootWindow_; } // tolua_export
 
         void setCamera(Ogre::Camera* camera);
@@ -120,4 +127,7 @@
         CEGUI::ResourceProvider*             resourceProvider_; //!< CEGUI's resource provider
         CEGUI::Logger*                       ceguiLogger_;      //!< CEGUI's logger to be able to log CEGUI errors in our log
+        CEGUI::Window*                       rootWindow_;       //!< Root node for all windows
+        CEGUI::Window*                       hudRootWindow_;    //!< Root node for the HUD sheets
+        CEGUI::Window*                       menuRootWindow_;   //!< Root node for the menu sheets (used by Lua)
         std::map<std::string, PlayerInfo*>   players_;          //!< Stores the player (owner) for each GUI
         Ogre::Camera*                        camera_;           //!< Camera used to render the scene with the GUI
