[Orxonox-commit 1306] r6024 - in code/branches/menu: . data/gui/layouts data/gui/scripts src/libraries/core src/modules/overlays src/orxonox/gamestates src/orxonox/pickup

scheusso at orxonox.net scheusso at orxonox.net
Wed Nov 4 14:14:54 CET 2009


Author: scheusso
Date: 2009-11-04 14:14:53 +0100 (Wed, 04 Nov 2009)
New Revision: 6024

Added:
   code/branches/menu/data/gui/layouts/InGameMenu.layout
   code/branches/menu/data/gui/scripts/InGameMenu.lua
Modified:
   code/branches/menu/
   code/branches/menu/data/gui/layouts/MainMenu.layout
   code/branches/menu/data/gui/layouts/QuestGUI.layout
   code/branches/menu/data/gui/scripts/InitialiseGUI.lua
   code/branches/menu/data/gui/scripts/MainMenu.lua
   code/branches/menu/src/libraries/core/CMakeLists.txt
   code/branches/menu/src/libraries/core/GUIManager.cc
   code/branches/menu/src/libraries/core/GUIManager.h
   code/branches/menu/src/libraries/core/Game.h
   code/branches/menu/src/libraries/core/LuaState.cc
   code/branches/menu/src/modules/overlays/GUIOverlay.cc
   code/branches/menu/src/orxonox/gamestates/GSGraphics.cc
   code/branches/menu/src/orxonox/gamestates/GSGraphics.h
   code/branches/menu/src/orxonox/gamestates/GSLevel.cc
   code/branches/menu/src/orxonox/gamestates/GSMainMenu.cc
   code/branches/menu/src/orxonox/pickup/PickupInventory.cc
   code/branches/menu/src/orxonox/pickup/PickupSpawner.cc
Log:
merged ingamemenu branch to menu branch



Property changes on: code/branches/menu
___________________________________________________________________
Modified: svn:mergeinfo
   - /code/branches/core5:5768-5928
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/resource2:3372-5694
/code/trunk:5951
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
code/branches/core3:1572-1739
code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
code/branches/miniprojects:2754-2824
code/branches/netp2:2835-2988
code/branches/netp3:2988-3082
code/branches/netp6:3214-3302
code/branches/network:2356
code/branches/network64:2210-2355
code/branches/objecthierarchy:1911-2085,2100,2110-2169
code/branches/objecthierarchy2:2171-2479
code/branches/overlay:2117-2385
code/branches/particles:2829-3085
code/branches/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890
   + /code/branches/core5:5768-5928
/code/branches/ingamemenu:6000-6023
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/resource2:3372-5694
/code/trunk:5951
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
code/branches/core3:1572-1739
code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
code/branches/miniprojects:2754-2824
code/branches/netp2:2835-2988
code/branches/netp3:2988-3082
code/branches/netp6:3214-3302
code/branches/network:2356
code/branches/network64:2210-2355
code/branches/objecthierarchy:1911-2085,2100,2110-2169
code/branches/objecthierarchy2:2171-2479
code/branches/overlay:2117-2385
code/branches/particles:2829-3085
code/branches/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890

Copied: code/branches/menu/data/gui/layouts/InGameMenu.layout (from rev 6023, code/branches/ingamemenu/data/gui/layouts/InGameMenu.layout)
===================================================================
--- code/branches/menu/data/gui/layouts/InGameMenu.layout	                        (rev 0)
+++ code/branches/menu/data/gui/layouts/InGameMenu.layout	2009-11-04 13:14:53 UTC (rev 6024)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+    <Window Type="DefaultWindow" Name="orxonox/InGameMenu_RootWindow" >
+        <Property Name="InheritsAlpha" Value="False" />
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+        <Window Type="TaharezLook/Button" Name="orxonox/InGameMenu_MainMenuButton" >
+            <Property Name="Font" Value="BlueHighway-12" />
+            <Property Name="Text" Value="MainMenu" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.2,0},{0.6,0},{0.3,0}}" />
+            <Property Name="Alpha" Value="0.7" />
+            <Event Name="Clicked" Function="InGameMenu.button_mainmenu_clicked"/>
+        </Window>
+        <Window Type="TaharezLook/Button" Name="orxonox/InGameMenu_QuitButton" >
+            <Property Name="Font" Value="BlueHighway-12" />
+            <Property Name="Text" Value="Quit" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.4,0},{0.6,0},{0.5,0}}" />
+            <Property Name="Alpha" Value="0.7" />
+            <Event Name="Clicked" Function="InGameMenu.button_quit_clicked"/>
+        </Window>
+        <Window Type="TaharezLook/Button" Name="orxonox/InGameMenu_ReturnButton" >
+            <Property Name="Font" Value="BlueHighway-12" />
+            <Property Name="Text" Value="return to Game" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6,0},{0.6,0},{0.7,0}}" />
+            <Property Name="Alpha" Value="0.7" />
+            <Event Name="Clicked" Function="InGameMenu.button_return_clicked"/>
+        </Window>
+    </Window>
+</GUILayout>

Modified: code/branches/menu/data/gui/layouts/MainMenu.layout
===================================================================
--- code/branches/menu/data/gui/layouts/MainMenu.layout	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/data/gui/layouts/MainMenu.layout	2009-11-04 13:14:53 UTC (rev 6024)
@@ -5,6 +5,7 @@
     <Property Name="Image" Value="set:MainMenuBackground image:Background"/>
     <Property Name="FrameEnabled" Value="set:true"/>
     <Property Name="BackgroundEnabled" Value="set:false"/>
+    <Property Name="InheritsAlpha" Value="False" />
  
         <Window Type="TaharezLook/Button" Name="orxonox/StandaloneButton">
             <Property Name="UnifiedPosition" Value="{{0.11,0},{0.3,0}}"/>

Modified: code/branches/menu/data/gui/layouts/QuestGUI.layout
===================================================================
--- code/branches/menu/data/gui/layouts/QuestGUI.layout	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/data/gui/layouts/QuestGUI.layout	2009-11-04 13:14:53 UTC (rev 6024)
@@ -5,6 +5,7 @@
     <Property Name="Image" Value="set:MainMenuBackground image:Background"/>
     <Property Name="FrameEnabled" Value="set:true"/>
     <Property Name="BackgroundEnabled" Value="set:false"/>
+    <Property Name="InheritsAlpha" Value="False" />
 
         <Window Type="TaharezLook/Titlebar" Name="orxonox/QuestGUI/Title">
             <Property Name="UnifiedPosition" Value="{{0.05,0},{0.05,0}}"/>

Copied: code/branches/menu/data/gui/scripts/InGameMenu.lua (from rev 6023, code/branches/ingamemenu/data/gui/scripts/InGameMenu.lua)
===================================================================
--- code/branches/menu/data/gui/scripts/InGameMenu.lua	                        (rev 0)
+++ code/branches/menu/data/gui/scripts/InGameMenu.lua	2009-11-04 13:14:53 UTC (rev 6024)
@@ -0,0 +1,37 @@
+-- InGameMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    InGameMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "InGameMenu"
+P.layoutString = "InGameMenu.layout"
+
+function P:init()
+end
+
+
+-- events for ingamemenu
+function P.button_quit_clicked(e)
+    orxonox.CommandExecutor:execute("hideGUI InGameMenu")
+    orxonox.CommandExecutor:execute("exit")
+end
+
+function P.button_mainmenu_clicked(e)
+    orxonox.Game:getInstance():popState()
+    orxonox.Game:getInstance():popState()
+    orxonox.Game:getInstance():requestState("mainmenu")
+    orxonox.CommandExecutor:execute("showGUI MainMenu")
+    orxonox.CommandExecutor:execute("hideGUI InGameMenu")
+end
+
+function P.button_return_clicked(e)
+    orxonox.CommandExecutor:execute("hideGUI InGameMenu")
+end
+
+return P
+

Modified: code/branches/menu/data/gui/scripts/InitialiseGUI.lua
===================================================================
--- code/branches/menu/data/gui/scripts/InitialiseGUI.lua	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/data/gui/scripts/InitialiseGUI.lua	2009-11-04 13:14:53 UTC (rev 6024)
@@ -13,6 +13,11 @@
 system:setDefaultTooltip("TaharezLook/Tooltip")
 
 loadedGUIs = {}
+cursorVisibility = {}
+activeSheets = {}
+nrOfActiveSheets = 0
+root = nil
+bShowsCursor = false
 
 -- loads the GUI with the specified filename
 -- be sure to set the global variable "filename" before calling this function
@@ -34,51 +39,93 @@
     return loadedGui
 end
 
-function showGUI(filename, ptr)
-    gui = showGUI(filename)
+function showGUI(filename, bCursorVisible, ptr)
+    gui = showGUI(filename, bCursorVisible)
     gui.overlay = ptr
 end
 
 -- shows the specified and loads it if not loaded already
 -- be sure to set the global variable "filename" before calling this function
-function showGUI(filename)
-    if current == nil or current.filename ~= filename then
-        current = loadedGUIs[filename]
-        if current == nil then
-            current = loadGUI(filename)
-        end
-        system:setGUISheet(current.window)
+function showGUI(filename, bCursorVisible)
+--     bCursorVisibile=false
+    if bCursorVisible == nil then
+        cursorVisibility= true
     end
-    current:show()
-    showing = true
-    return current
-end
 
-function toggleGUI()
-    if showing == true then
-        current:hide()
-        cursor:hide()
-        showing = false
+    if root == nil then
+        root = winMgr:createWindow("TaharezLook/StaticImage", "AbsoluteRootWindow")
+        root:setProperty("Alpha", "0.0")
+        root:setSize(CEGUI.UVector2(CEGUI.UDim(1.0,0),CEGUI.UDim(1.0,0)))
+        system:setGUISheet(root)
+    end
+
+    local currentGUI = loadedGUIs[filename]
+    if(currentGUI == nil) then
+        currentGUI = loadGUI(filename)
+    end
+
+    if(root:isChild(currentGUI.window)) then
+        root:removeChildWindow(currentGUI.window)
+    end
+    root:addChildWindow(currentGUI.window)
+
+    if bCursorVisible then
+        showCursor()
     else
-        current:show()
-        cursor:show()
-        showing = true
+        hideCursor()
     end
-    return showing
+    cursorVisibility[filename]=bCursorVisible
+    
+    nrOfActiveSheets = nrOfActiveSheets + 1
+    table.insert(activeSheets, filename)
+    activeSheets[nrOfActiveSheets] = filename
+    
+    currentGUI:show()
+    showing = true
+    return currentGUI
 end
 
 function hideCursor()
-    cursor:hide()
+    if bShowsCursor==true then
+        bShowsCursor=false
+        cursor:hide()
+    end
 end
 
 function showCursor()
-    cursor:show()
+    if bShowsCursor==false then
+        bShowsCursor=true
+        cursor:show()
+    end
 end
 
 function hideGUI(filename)
-    current = loadedGUIs[filename]
-    if current ~= nil then
-        current:hide()
-        showing = false
+    local currentGUI = loadedGUIs[filename]
+    if currentGUI == nil then
+        return
     end
+    currentGUI:hide()
+    root:removeChildWindow(currentGUI.window)
+    showing = false
+    i=1
+    while activeSheets[i] do
+        if activeSheets[i+1] == nil then
+            if activeSheets[i-1] ~= nil then
+                if cursorVisibility[ activeSheets[i-1] ] == true then
+                    showCursor()
+                else
+                    hideCursor()
+                end
+            else
+                hideCursor()
+            end
+        end
+        if activeSheets[i] == filename then
+            table.remove( activeSheets, i )
+            nrOfActiveSheets = nrOfActiveSheets-1
+        else
+            i = i+1
+        end
+    end
+    cursorVisibility[filename] = nil -- remove the cursor visibility of the current gui from the table
 end

Modified: code/branches/menu/data/gui/scripts/MainMenu.lua
===================================================================
--- code/branches/menu/data/gui/scripts/MainMenu.lua	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/data/gui/scripts/MainMenu.lua	2009-11-04 13:14:53 UTC (rev 6024)
@@ -49,7 +49,7 @@
     if choice then
         orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
         orxonox.CommandExecutor:execute("startGame")
-        toggleGUI()
+        hideGUI(P.filename)
     end
 end
 
@@ -58,7 +58,7 @@
     if choice then
         orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
         orxonox.CommandExecutor:execute("startServer")
-        toggleGUI()
+        hideGUI(P.filename)
     end
 end
 
@@ -67,7 +67,7 @@
     if choice then
         orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
         orxonox.CommandExecutor:execute("startDedicated")
-        toggleGUI()
+        hideGUI(P.filename)
     end
 end
 
@@ -76,7 +76,8 @@
     if choice then
         orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
         orxonox.CommandExecutor:execute("startClient")
-        toggleGUI()
+        hideGUI(P.filename)
+
     end
 end
 

Modified: code/branches/menu/src/libraries/core/CMakeLists.txt
===================================================================
--- code/branches/menu/src/libraries/core/CMakeLists.txt	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/src/libraries/core/CMakeLists.txt	2009-11-04 13:14:53 UTC (rev 6024)
@@ -84,6 +84,7 @@
   FIND_HEADER_FILES
   TOLUA_FILES
     CommandExecutor.h
+    Game.h
     Loader.h
     LuaState.h
   DEFINE_SYMBOL

Modified: code/branches/menu/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/menu/src/libraries/core/GUIManager.cc	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/src/libraries/core/GUIManager.cc	2009-11-04 13:14:53 UTC (rev 6024)
@@ -49,10 +49,13 @@
 #endif
 
 #include "util/Clock.h"
+#include "util/Convert.h"
 #include "util/Debug.h"
 #include "util/Exception.h"
 #include "util/OrxAssert.h"
+#include "ConsoleCommand.h"
 #include "Core.h"
+#include "input/InputManager.h"
 #include "LuaState.h"
 #include "PathConfig.h"
 #include "Resource.h"
@@ -85,6 +88,9 @@
 
     GUIManager* GUIManager::singletonPtr_s = 0;
 
+    SetConsoleCommandShortcut(GUIManager, showGUI).accessLevel(AccessLevel::User).defaultValue(1, true);
+    SetConsoleCommandShortcut(GUIManager, hideGUI).accessLevel(AccessLevel::User);
+
     /**
     @brief
         Constructs the GUIManager by starting up CEGUI
@@ -203,11 +209,55 @@
         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)
+    /*static*/ void GUIManager::showGUI(const std::string& name, bool showCursor)
     {
-        this->luaState_->doString("showGUI(\"" + name + "\")", rootFileInfo_);
+        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 + "\", " + multi_cast<std::string>(showCursor) + ")");
     }
 
+    /**
+    @brief
+        Hack-ish. Needed for GUIOverlay.
+    */
+    void GUIManager::showGUIExtra(const std::string& name, const std::string& ptr, bool showCursor)
+    {
+        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 + "\", " + multi_cast<std::string>(showCursor) + ", " + 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");
+        }
+    }
+
     void GUIManager::keyPressed(const KeyEvent& evt)
     {
         guiSystem_->injectKeyDown(evt.getKeyCode());

Modified: code/branches/menu/src/libraries/core/GUIManager.h
===================================================================
--- code/branches/menu/src/libraries/core/GUIManager.h	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/src/libraries/core/GUIManager.h	2009-11-04 13:14:53 UTC (rev 6024)
@@ -33,6 +33,7 @@
 #include "CorePrereqs.h"
 
 #include <map>
+#include <set>
 #include <string>
 #include <CEGUIForwardRefs.h>
 #include <boost/scoped_ptr.hpp>
@@ -64,10 +65,11 @@
         GUIManager(Ogre::RenderWindow* renderWindow, const std::pair<int, int>& mousePosition, bool bFullScreen);
         ~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, bool showCursor=true);
+        void showGUIExtra(const std::string& name, const std::string& ptr, bool showCursor=true);
+        static void hideGUI(const std::string& name);
 
         void setCamera(Ogre::Camera* camera);
         Ogre::Camera* getCamera() { return this->camera_; }
@@ -82,6 +84,10 @@
     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
         void keyPressed (const KeyEvent& evt);
         void keyReleased(const KeyEvent& evt);

Modified: code/branches/menu/src/libraries/core/Game.h
===================================================================
--- code/branches/menu/src/libraries/core/Game.h	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/src/libraries/core/Game.h	2009-11-04 13:14:53 UTC (rev 6024)
@@ -57,9 +57,10 @@
 */
 #define DeclareGameState(className, stateName, bIgnoreTickTime, bGraphicsMode) \
     static bool BOOST_PP_CAT(bGameStateDummy_##className, __LINE__) = orxonox::Game::declareGameState<className>(#className, stateName, bIgnoreTickTime, bGraphicsMode)
-
+// tolua_begin
 namespace orxonox
 {
+// tolua_end
     class GameConfiguration;
 
     //! Helper object required before GameStates are being constructed
@@ -77,8 +78,11 @@
     @remark
         You should only create this singleton once because it owns the Core class! (see remark there)
     */
-    class _CoreExport Game : public Singleton<Game>
+// tolua_begin
+    class _CoreExport Game
+        : public Singleton<Game>
     {
+// tolua_end
         friend class Singleton<Game>;
         typedef std::vector<shared_ptr<GameState> > GameStateVector;
         typedef std::map<std::string, shared_ptr<GameState> > GameStateMap;
@@ -94,10 +98,12 @@
         void run();
         void stop();
 
-        void requestState(const std::string& name);
-        void requestStates(const std::string& names);
-        void popState();
+        static Game& getInstance(){ return Singleton<Game>::getInstance(); } // tolua_export
 
+        void requestState(const std::string& name); //tolua_export
+        void requestStates(const std::string& names); //tolua_export
+        void popState(); //tolua_export
+
         const Clock& getGameClock() { return *this->gameClock_; }
 
         float getAvgTickTime() { return this->avgTickTime_; }
@@ -182,7 +188,7 @@
 
         static std::map<std::string, GameStateInfo> gameStateDeclarations_s;
         static Game* singletonPtr_s;        //!< Pointer to the Singleton
-    };
+    }; //tolua_export
 
     template <class T>
     /*static*/ bool Game::declareGameState(const std::string& className, const std::string& stateName, bool bIgnoreTickTime, bool bGraphicsMode)
@@ -208,6 +214,6 @@
         // just a required dummy return value
         return true;
     }
-}
+} //tolua_export
 
 #endif /* _Game_H__ */

Modified: code/branches/menu/src/libraries/core/LuaState.cc
===================================================================
--- code/branches/menu/src/libraries/core/LuaState.cc	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/src/libraries/core/LuaState.cc	2009-11-04 13:14:53 UTC (rev 6024)
@@ -163,7 +163,7 @@
             std::string origin;
             if (sourceFileInfo != NULL)
                 origin = " originating from " + sourceFileInfo_->filename;
-            COUT(2) << "Error in Lua-script" << origin << ": " << lua_tostring(luaState_, -1) << std::endl;
+            COUT(1) << "Error in Lua-script" << origin << ": " << lua_tostring(luaState_, -1) << std::endl;
             // return value is nil
             lua_pushnil(luaState_);
         }

Modified: code/branches/menu/src/modules/overlays/GUIOverlay.cc
===================================================================
--- code/branches/menu/src/modules/overlays/GUIOverlay.cc	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/src/modules/overlays/GUIOverlay.cc	2009-11-04 13:14:53 UTC (rev 6024)
@@ -71,15 +71,12 @@
             std::stringstream out;
             out << reinterpret_cast<long>(this);
             str = out.str();
-            GUIManager::getInstance().executeCode("showCursor()");
-            InputManager::getInstance().enterState("guiMouseOnly");
-            GUIManager::getInstance().executeCode("showGUI(\"" + this->guiName_ + "\", " + str + ")");
+            COUT(1) << "GUIManager ptr: " << str << std::endl;
+            GUIManager::getInstance().showGUIExtra(this->guiName_, str);
         }
         else
         {
-            GUIManager::getInstance().executeCode("hideGUI(\"" + this->guiName_ + "\")");
-            GUIManager::getInstance().executeCode("hideCursor()");
-            InputManager::getInstance().leaveState("guiMouseOnly");
+            GUIManager::hideGUI(this->guiName_);
         }
     }
 

Modified: code/branches/menu/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- code/branches/menu/src/orxonox/gamestates/GSGraphics.cc	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/src/orxonox/gamestates/GSGraphics.cc	2009-11-04 13:14:53 UTC (rev 6024)
@@ -63,8 +63,7 @@
     */
     void GSGraphics::activate()
     {
-        // add console command to toggle GUI
-        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSGraphics::toggleGUI, this), "toggleGUI"));
+        
     }
 
     /**
@@ -77,18 +76,6 @@
         Map::hackDestroyMap();
     }
 
-    /**
-    @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()
-    {
-        GUIManager::getInstance().executeCode("toggleGUI()");
-    }
-
     void GSGraphics::update(const Clock& time)
     {
         if (this->getActivity().topState)

Modified: code/branches/menu/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- code/branches/menu/src/orxonox/gamestates/GSGraphics.h	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/src/orxonox/gamestates/GSGraphics.h	2009-11-04 13:14:53 UTC (rev 6024)
@@ -56,8 +56,6 @@
         void deactivate();
         void update(const Clock& time);
 
-        void toggleGUI();
-
     private:
     };
 }

Modified: code/branches/menu/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/branches/menu/src/orxonox/gamestates/GSLevel.cc	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/src/orxonox/gamestates/GSLevel.cc	2009-11-04 13:14:53 UTC (rev 6024)
@@ -100,15 +100,11 @@
     {
         if (show)
         {
-            GUIManager::getInstance().showGUI("inGameTest");
-            GUIManager::getInstance().executeCode("showCursor()");
-            InputManager::getInstance().enterState("guiMouseOnly");
+            GUIManager::showGUI("inGameTest");
         }
         else
         {
-            GUIManager::getInstance().executeCode("hideGUI(\"inGameTest\")");
-            GUIManager::getInstance().executeCode("hideCursor()");
-            InputManager::getInstance().leaveState("guiMouseOnly");
+            GUIManager::hideGUI("inGameTest");
         }
     }
 

Modified: code/branches/menu/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/branches/menu/src/orxonox/gamestates/GSMainMenu.cc	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/src/orxonox/gamestates/GSMainMenu.cc	2009-11-04 13:14:53 UTC (rev 6024)
@@ -81,7 +81,7 @@
     void GSMainMenu::activate()
     {
         // show main menu
-        GUIManager::getInstance().showGUI("MainMenu");
+        GUIManager::getInstance().showGUI("MainMenu", false);
         GUIManager::getInstance().setCamera(this->camera_);
         GraphicsManager::getInstance().setCamera(this->camera_);
 
@@ -112,6 +112,7 @@
         InputManager::getInstance().leaveState("mainMenu");
 
         GUIManager::getInstance().setCamera(0);
+        GUIManager::hideGUI("MainMenu");
         GraphicsManager::getInstance().setCamera(0);
     }
 

Modified: code/branches/menu/src/orxonox/pickup/PickupInventory.cc
===================================================================
--- code/branches/menu/src/orxonox/pickup/PickupInventory.cc	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/src/orxonox/pickup/PickupInventory.cc	2009-11-04 13:14:53 UTC (rev 6024)
@@ -85,15 +85,11 @@
     void PickupInventory::toggleInventory()
     {
         if(PickupInventory::getSingleton()->isVisible()) {
-            GUIManager::getInstance().executeCode("hideGUI(\"PickupInventory\")");
-            GUIManager::getInstance().executeCode("hideCursor()");
-            InputManager::getInstance().leaveState("guiMouseOnly");
+            GUIManager::hideGUI("PickupInventory");
         }
         else
         {
-            GUIManager::getInstance().showGUI("PickupInventory");
-            GUIManager::getInstance().executeCode("showCursor()");
-            InputManager::getInstance().enterState("guiMouseOnly");
+            GUIManager::showGUI("PickupInventory");
         }
         PickupInventory::getSingleton()->setVisible(!PickupInventory::getSingleton()->isVisible());
     }

Modified: code/branches/menu/src/orxonox/pickup/PickupSpawner.cc
===================================================================
--- code/branches/menu/src/orxonox/pickup/PickupSpawner.cc	2009-11-04 12:59:39 UTC (rev 6023)
+++ code/branches/menu/src/orxonox/pickup/PickupSpawner.cc	2009-11-04 13:14:53 UTC (rev 6024)
@@ -95,8 +95,8 @@
 
         //  & load the GUI itself too, along with some empty windows
         //   = even less delays
-        GUIManager::getInstance().showGUI("PickupInventory");
-        GUIManager::getInstance().executeCode("hideGUI(\"PickupInventory\")");
+        GUIManager::showGUI("PickupInventory");
+        GUIManager::hideGUI("PickupInventory");
         PickupInventory::getSingleton();
     }
     /**




More information about the Orxonox-commit mailing list