Index: code/branches/ingamemenu/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/ingamemenu/src/libraries/core/GUIManager.cc	(revision 5999)
+++ code/branches/ingamemenu/src/libraries/core/GUIManager.cc	(revision 6003)
@@ -53,5 +53,7 @@
 #include "util/Exception.h"
 #include "util/OrxAssert.h"
+#include "ConsoleCommand.h"
 #include "Core.h"
+#include "input/InputManager.h"
 #include "LuaState.h"
 #include "PathConfig.h"
@@ -86,4 +88,7 @@
     GUIManager* GUIManager::singletonPtr_s = 0;
 
+    SetConsoleCommandShortcut(GUIManager, showGUI).accessLevel(AccessLevel::User);
+    SetConsoleCommandShortcut(GUIManager, hideGUI).accessLevel(AccessLevel::User);
+
     /**
     @brief
@@ -204,7 +209,51 @@
         For more details check out loadGUI_2.lua where the function presides.
     */
-    void GUIManager::showGUI(const std::string& name)
-    {
-        this->luaState_->doString("showGUI(\"" + name + "\")", rootFileInfo_);
+    /*static*/ void GUIManager::showGUI(const std::string& name)
+    {
+        std::pair<std::set<std::string>::iterator,bool> result = GUIManager::getInstance().showingGUIs_.insert(name);
+        if(result.second == false) //!< GUI already showing.
+            return;
+        if(GUIManager::getInstance().showingGUIs_.size() == 1 && result.second == true) //!< If it's the first GUI.
+        {
+            GUIManager::getInstance().executeCode("showCursor()");
+            InputManager::getInstance().enterState("guiMouseOnly");
+        }
+        GUIManager::getInstance().executeCode("showGUI(\"" + name + "\")");
+    }
+
+    /**
+    @brief
+        Hack-ish. Needed for GUIOverlay.
+    */
+    void GUIManager::showGUIExtra(const std::string& name, const std::string& ptr)
+    {
+        std::pair<std::set<std::string>::iterator,bool> result = this->showingGUIs_.insert(name);
+        if(result.second == false) //!< GUI already showing.
+            return;
+        if(this->showingGUIs_.size() == 1 && result.second == true) //!< If it's the first GUI.
+        {
+            this->executeCode("showCursor()");
+            InputManager::getInstance().enterState("guiMouseOnly");
+        }
+        this->executeCode("showGUI(\"" + name + "\", " + ptr + ")");
+    }
+
+    /**
+    @brief
+        Hides specified GUI.
+    @param name
+        The name of the GUI.
+    */
+    /*static*/ void GUIManager::hideGUI(const std::string& name)
+    {
+        bool present = GUIManager::getInstance().showingGUIs_.erase(name);
+        if(!present) //!< If there was nothing to erase.
+            return;
+        GUIManager::getInstance().executeCode("hideGUI(\"" + name + "\")");
+        if(GUIManager::getInstance().showingGUIs_.size() == 0)
+        {
+            GUIManager::getInstance().executeCode("hideCursor()");
+            InputManager::getInstance().leaveState("guiMouseOnly");
+        }
     }
 
Index: code/branches/ingamemenu/src/libraries/core/GUIManager.h
===================================================================
--- code/branches/ingamemenu/src/libraries/core/GUIManager.h	(revision 5999)
+++ code/branches/ingamemenu/src/libraries/core/GUIManager.h	(revision 6003)
@@ -34,4 +34,5 @@
 
 #include <map>
+#include <set>
 #include <string>
 #include <CEGUIForwardRefs.h>
@@ -65,8 +66,9 @@
         ~GUIManager();
 
-        void update(const Clock& time);
+        void update(const Clock& time); 
 
-        void showGUI(const std::string& name);
-        void executeCode(const std::string& str);
+        static void showGUI(const std::string& name);
+        void showGUIExtra(const std::string& name, const std::string& ptr);
+        static void hideGUI(const std::string& name);
 
         void setCamera(Ogre::Camera* camera);
@@ -82,4 +84,8 @@
     private:
         GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class)
+
+        std::set<std::string> showingGUIs_; //!< Keeps track of all the GUIs that are currently showing.
+
+        void executeCode(const std::string& str);
 
         // keyHandler functions
