[Orxonox-commit 175] r2850 - in branches/gui: bin src/core src/orxonox src/orxonox/gamestates src/orxonox/gui

rgrieder at orxonox.net rgrieder at orxonox.net
Wed Mar 25 23:53:05 CET 2009


Author: rgrieder
Date: 2009-03-25 22:53:04 +0000 (Wed, 25 Mar 2009)
New Revision: 2850

Added:
   branches/gui/src/orxonox/gamestates/GSMainMenu.cc
   branches/gui/src/orxonox/gamestates/GSMainMenu.h
Removed:
   branches/gui/src/orxonox/gamestates/GSGUI.cc
   branches/gui/src/orxonox/gamestates/GSGUI.h
Modified:
   branches/gui/bin/client1.bat.in
   branches/gui/bin/client1.in
   branches/gui/bin/client2.bat.in
   branches/gui/bin/client2.in
   branches/gui/bin/dedicated.bat.in
   branches/gui/bin/dedicated.in
   branches/gui/bin/server.bat.in
   branches/gui/bin/server.in
   branches/gui/bin/standalone.bat.in
   branches/gui/bin/standalone.in
   branches/gui/src/core/Game.cc
   branches/gui/src/core/Game.h
   branches/gui/src/core/GameState.cc
   branches/gui/src/core/GameState.h
   branches/gui/src/orxonox/CameraManager.cc
   branches/gui/src/orxonox/GraphicsManager.cc
   branches/gui/src/orxonox/GraphicsManager.h
   branches/gui/src/orxonox/gamestates/CMakeLists.txt
   branches/gui/src/orxonox/gamestates/GSGraphics.cc
   branches/gui/src/orxonox/gamestates/GSIOConsole.cc
   branches/gui/src/orxonox/gamestates/GSIOConsole.h
   branches/gui/src/orxonox/gamestates/GSLevel.cc
   branches/gui/src/orxonox/gamestates/GSLevel.h
   branches/gui/src/orxonox/gamestates/GSRoot.cc
   branches/gui/src/orxonox/gui/GUIManager.cc
   branches/gui/src/orxonox/gui/GUIManager.h
Log:
- Started working on cleaning up the GameState mess ;)
- Cleaned out GUIManager
- Renamed GSGUI to GSMainMenu
- "--state blah" has been changed to --server, --client, --standalone, --dedicated
- --console starts the game in the console (no level loading there yet, but "loadMenu")
- adjusted run scripts

Modified: branches/gui/bin/client1.bat.in
===================================================================
--- branches/gui/bin/client1.bat.in	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/bin/client1.bat.in	2009-03-25 22:53:04 UTC (rev 2850)
@@ -1,4 +1,4 @@
 title @PROJECT_NAME@
 path @ORXONOX_RUNTIME_LIBRARY_DIRECTORY_WINDOWS@;%path%
- at CURRENT_RUNTIME_DIR_WINDOWS@\@ORXONOX_EXECUTABLE_NAME@ --state client --writingPathSuffix client1
+ at CURRENT_RUNTIME_DIR_WINDOWS@\@ORXONOX_EXECUTABLE_NAME@ --client --writingPathSuffix client1
 pause

Modified: branches/gui/bin/client1.in
===================================================================
--- branches/gui/bin/client1.in	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/bin/client1.in	2009-03-25 22:53:04 UTC (rev 2850)
@@ -1,4 +1,4 @@
 #!/bin/sh
 # convenience script for starting orxonox on Linux
 
-exec @CURRENT_RUNTIME_DIR@/@ORXONOX_EXECUTABLE_NAME@ --state client --writingPathSuffix client1 $@
+exec @CURRENT_RUNTIME_DIR@/@ORXONOX_EXECUTABLE_NAME@ --client --writingPathSuffix client1 $@

Modified: branches/gui/bin/client2.bat.in
===================================================================
--- branches/gui/bin/client2.bat.in	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/bin/client2.bat.in	2009-03-25 22:53:04 UTC (rev 2850)
@@ -1,4 +1,4 @@
 title @PROJECT_NAME@
 path @ORXONOX_RUNTIME_LIBRARY_DIRECTORY_WINDOWS@;%path%
- at CURRENT_RUNTIME_DIR_WINDOWS@\@ORXONOX_EXECUTABLE_NAME@ --state client --writingPathSuffix client2
+ at CURRENT_RUNTIME_DIR_WINDOWS@\@ORXONOX_EXECUTABLE_NAME@ --client --writingPathSuffix client2
 pause

Modified: branches/gui/bin/client2.in
===================================================================
--- branches/gui/bin/client2.in	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/bin/client2.in	2009-03-25 22:53:04 UTC (rev 2850)
@@ -1,4 +1,4 @@
 #!/bin/sh
 # convenience script for starting orxonox on Linux
 
-exec @CURRENT_RUNTIME_DIR@/@ORXONOX_EXECUTABLE_NAME@ --state client --writingPathSuffix client2 $@
+exec @CURRENT_RUNTIME_DIR@/@ORXONOX_EXECUTABLE_NAME@ --client --writingPathSuffix client2 $@

Modified: branches/gui/bin/dedicated.bat.in
===================================================================
--- branches/gui/bin/dedicated.bat.in	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/bin/dedicated.bat.in	2009-03-25 22:53:04 UTC (rev 2850)
@@ -1,4 +1,4 @@
 title @PROJECT_NAME@
 path @ORXONOX_RUNTIME_LIBRARY_DIRECTORY_WINDOWS@;%path%
- at CURRENT_RUNTIME_DIR_WINDOWS@\@ORXONOX_EXECUTABLE_NAME@ --state dedicated --writingPathSuffix dedicated
+ at CURRENT_RUNTIME_DIR_WINDOWS@\@ORXONOX_EXECUTABLE_NAME@ --dedicated --writingPathSuffix dedicated
 pause

Modified: branches/gui/bin/dedicated.in
===================================================================
--- branches/gui/bin/dedicated.in	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/bin/dedicated.in	2009-03-25 22:53:04 UTC (rev 2850)
@@ -1,4 +1,4 @@
 #!/bin/sh
 # convenience script for starting orxonox on Linux
 
-exec @CURRENT_RUNTIME_DIR@/@ORXONOX_EXECUTABLE_NAME@ --state dedicated --writingPathSuffix dedicated $@
+exec @CURRENT_RUNTIME_DIR@/@ORXONOX_EXECUTABLE_NAME@ --dedicated --writingPathSuffix dedicated $@

Modified: branches/gui/bin/server.bat.in
===================================================================
--- branches/gui/bin/server.bat.in	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/bin/server.bat.in	2009-03-25 22:53:04 UTC (rev 2850)
@@ -1,4 +1,4 @@
 title @PROJECT_NAME@
 path @ORXONOX_RUNTIME_LIBRARY_DIRECTORY_WINDOWS@;%path%
- at CURRENT_RUNTIME_DIR_WINDOWS@\@ORXONOX_EXECUTABLE_NAME@ --state server --writingPathSuffix server
+ at CURRENT_RUNTIME_DIR_WINDOWS@\@ORXONOX_EXECUTABLE_NAME@ --server --writingPathSuffix server
 pause

Modified: branches/gui/bin/server.in
===================================================================
--- branches/gui/bin/server.in	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/bin/server.in	2009-03-25 22:53:04 UTC (rev 2850)
@@ -1,4 +1,4 @@
 #!/bin/sh
 # convenience script for starting orxonox on Linux
 
-exec @CURRENT_RUNTIME_DIR@/@ORXONOX_EXECUTABLE_NAME@ --state server --writingPathSuffix server $@
+exec @CURRENT_RUNTIME_DIR@/@ORXONOX_EXECUTABLE_NAME@ --server --writingPathSuffix server $@

Modified: branches/gui/bin/standalone.bat.in
===================================================================
--- branches/gui/bin/standalone.bat.in	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/bin/standalone.bat.in	2009-03-25 22:53:04 UTC (rev 2850)
@@ -1,4 +1,4 @@
 title @PROJECT_NAME@
 path @ORXONOX_RUNTIME_LIBRARY_DIRECTORY_WINDOWS@;%path%
- at CURRENT_RUNTIME_DIR_WINDOWS@\@ORXONOX_EXECUTABLE_NAME@ --state standalone --writingPathSuffix standalone
+ at CURRENT_RUNTIME_DIR_WINDOWS@\@ORXONOX_EXECUTABLE_NAME@ --standalone --writingPathSuffix standalone
 pause

Modified: branches/gui/bin/standalone.in
===================================================================
--- branches/gui/bin/standalone.in	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/bin/standalone.in	2009-03-25 22:53:04 UTC (rev 2850)
@@ -1,4 +1,4 @@
 #!/bin/sh
 # convenience script for starting orxonox on Linux
 
-exec @CURRENT_RUNTIME_DIR@/@ORXONOX_EXECUTABLE_NAME@ --state standalone --writingPathSuffix standalone $@
+exec @CURRENT_RUNTIME_DIR@/@ORXONOX_EXECUTABLE_NAME@ --standalone --writingPathSuffix standalone $@

Modified: branches/gui/src/core/Game.cc
===================================================================
--- branches/gui/src/core/Game.cc	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/core/Game.cc	2009-03-25 22:53:04 UTC (rev 2850)
@@ -39,6 +39,7 @@
 
 #include "util/Debug.h"
 #include "util/Exception.h"
+#include "util/SubString.h"
 #include "Clock.h"
 #include "CommandLine.h"
 #include "ConsoleCommand.h"
@@ -246,7 +247,7 @@
 
         // Check parent and all its grand parents
         GameStateTreeNode* currentNode = lastRequestedNode;
-        while (requestedNode == NULL && currentNode->parent_ != NULL)
+        while (requestedNode == NULL && currentNode != NULL)
         {
             if (currentNode->state_ == state)
                 requestedNode = currentNode;
@@ -259,6 +260,13 @@
             this->requestedStateNodes_.push_back(requestedNode);
     }
 
+    void Game::requestStates(const std::string& names)
+    {
+        SubString tokens(names, ",;", " ");
+        for (unsigned int i = 0; i < tokens.size(); ++i)
+            this->requestState(tokens[i]);
+    }
+
     void Game::popState()
     {
         if (this->activeStateNode_ != NULL && this->requestedStateNodes_.back()->parent_)
@@ -269,7 +277,7 @@
 
     GameState* Game::getState(const std::string& name)
     {
-        std::map<std::string, GameState*>::const_iterator it = allStates_s.find(name);
+        std::map<std::string, GameState*>::const_iterator it = allStates_s.find(getLowercase(name));
         if (it != allStates_s.end())
             return it->second;
         else
@@ -355,21 +363,27 @@
 
     void Game::loadState(GameState* state)
     {
+        if (!this->activeStates_.empty())
+            this->activeStates_.back()->activity_.topState = false;
         state->activate();
+        state->activity_.topState = true;
         this->activeStates_.push_back(state);
     }
 
     void Game::unloadState(orxonox::GameState* state)
     {
+        state->activity_.topState = false;
         state->deactivate();
         this->activeStates_.pop_back();
+        if (!this->activeStates_.empty())
+            this->activeStates_.back()->activity_.topState = true;
     }
 
     /*static*/ bool Game::addGameState(GameState* state)
     {
-        std::map<std::string, GameState*>::const_iterator it = allStates_s.find(state->getName());
+        std::map<std::string, GameState*>::const_iterator it = allStates_s.find(getLowercase(state->getName()));
         if (it == allStates_s.end())
-            allStates_s[state->getName()] = state;
+            allStates_s[getLowercase(state->getName())] = state;
         else
             ThrowException(GameState, "Cannot add two GameStates with the same name to 'Game'.");
 

Modified: branches/gui/src/core/Game.h
===================================================================
--- branches/gui/src/core/Game.h	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/core/Game.h	2009-03-25 22:53:04 UTC (rev 2850)
@@ -65,6 +65,7 @@
         void stop();
 
         void requestState(const std::string& name);
+        void requestStates(const std::string& names);
         void popState();
 
         const Clock& getGameClock() { return *this->gameClock_; }

Modified: branches/gui/src/core/GameState.cc
===================================================================
--- branches/gui/src/core/GameState.cc	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/core/GameState.cc	2009-03-25 22:53:04 UTC (rev 2850)
@@ -48,8 +48,12 @@
         : name_(name)
         , parent_(0)
     {
-        State temp = {false, false, false, false, false};
-        this->activity_ = temp;
+        this->activity_.activating   = false;
+        this->activity_.active       = false;
+        this->activity_.deactivating = false;
+        this->activity_.suspended    = false;
+        this->activity_.topState     = false;
+        this->activity_.updating     = false;
     }
 
     /**

Modified: branches/gui/src/core/GameState.h
===================================================================
--- branches/gui/src/core/GameState.h	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/core/GameState.h	2009-03-25 22:53:04 UTC (rev 2850)
@@ -73,6 +73,7 @@
             unsigned deactivating : 1;
             unsigned updating     : 1;
             unsigned suspended    : 1;
+            unsigned topState     : 1;
         };
 
     public:
@@ -80,7 +81,7 @@
         virtual ~GameState();
 
         const std::string& getName() const { return name_; }
-        const State getActivity() const    { return this->activity_; }
+        State getActivity() const    { return this->activity_; }
         GameState* getParent() const       { return this->parent_; }
 
         void addChild(GameState* state);

Modified: branches/gui/src/orxonox/CameraManager.cc
===================================================================
--- branches/gui/src/orxonox/CameraManager.cc	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/CameraManager.cc	2009-03-25 22:53:04 UTC (rev 2850)
@@ -141,7 +141,7 @@
         }
 
         this->viewport_->setCamera(camera);
-        GUIManager::getInstancePtr()->setCamera(camera);
+        GUIManager::getInstance().setCamera(camera);
 
         // reactivate all visible compositors
         {

Modified: branches/gui/src/orxonox/GraphicsManager.cc
===================================================================
--- branches/gui/src/orxonox/GraphicsManager.cc	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/GraphicsManager.cc	2009-03-25 22:53:04 UTC (rev 2850)
@@ -215,6 +215,11 @@
         }
     }
 
+    void GraphicsManager::setCamera(Ogre::Camera* camera)
+    {
+        this->viewport_->setCamera(camera);
+    }
+
     /**
     @brief
         Creates the Ogre Root object and sets up the ogre log.

Modified: branches/gui/src/orxonox/GraphicsManager.h
===================================================================
--- branches/gui/src/orxonox/GraphicsManager.h	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/GraphicsManager.h	2009-03-25 22:53:04 UTC (rev 2850)
@@ -65,16 +65,15 @@
         inline unsigned int getDetailLevelParticle() const
             { return this->detailLevelParticle_; }
 
-        inline void setViewport(Ogre::Viewport* viewport)
-            { this->viewport_ = viewport; }
         inline Ogre::Viewport* getViewport() const
             { return this->viewport_; }
         inline Ogre::RenderWindow* getRenderWindow()
             { return this->renderWindow_; }
 
+        void setCamera(Ogre::Camera* camera);
+
         static GraphicsManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
 
-
     private:
         GraphicsManager(GraphicsManager&); // don't mess with singletons
 

Modified: branches/gui/src/orxonox/gamestates/CMakeLists.txt
===================================================================
--- branches/gui/src/orxonox/gamestates/CMakeLists.txt	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/gamestates/CMakeLists.txt	2009-03-25 22:53:04 UTC (rev 2850)
@@ -1,10 +1,10 @@
 ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+  GSClient.cc
   GSDedicated.cc
-  GSClient.cc
   GSGraphics.cc
-  GSGUI.cc
   GSIOConsole.cc
   GSLevel.cc
+  GSMainMenu.cc
   GSRoot.cc
   GSServer.cc
   GSStandalone.cc

Deleted: branches/gui/src/orxonox/gamestates/GSGUI.cc
===================================================================
--- branches/gui/src/orxonox/gamestates/GSGUI.cc	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/gamestates/GSGUI.cc	2009-03-25 22:53:04 UTC (rev 2850)
@@ -1,96 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "GSGUI.h"
-
-#include <OgreViewport.h>
-#include "core/Clock.h"
-#include "core/ConsoleCommand.h"
-#include "core/Game.h"
-#include "core/input/InputManager.h"
-#include "core/input/SimpleInputState.h"
-#include "gui/GUIManager.h"
-#include "GraphicsManager.h"
-
-namespace orxonox
-{
-    AddGameState(GSGUI, "mainMenu");
-
-    GSGUI::GSGUI(const std::string& name)
-        : GameState(name)
-    {
-    }
-
-    GSGUI::~GSGUI()
-    {
-    }
-
-    void GSGUI::activate()
-    {
-        guiManager_ = GUIManager::getInstancePtr();
-
-        // show main menu
-        //guiManager_->loadScene("MainMenu");
-        guiManager_->showGUI("MainMenu", 0);
-        GraphicsManager::getInstance().getViewport()->setCamera(guiManager_->getCamera());
-
-        {
-            // time factor console command
-            FunctorMember<GSGUI>* functor = createFunctor(&GSGUI::startGame);
-            functor->setObject(this);
-            this->ccStartGame_ = createConsoleCommand(functor, "startGame");
-            CommandExecutor::addConsoleCommandShortcut(this->ccStartGame_);
-        }
-    }
-
-    void GSGUI::deactivate()
-    {
-        if (this->ccStartGame_)
-        {
-            delete this->ccStartGame_;
-            this->ccStartGame_ = 0;
-        }
-
-        guiManager_->hideGUI();
-    }
-
-    void GSGUI::update(const Clock& time)
-    {
-        // tick CEGUI
-        guiManager_->update(time);
-    }
-
-    void GSGUI::startGame()
-    {
-        // HACK - HACK
-        Game::getInstance().popState();
-        Game::getInstance().requestState("standalone");
-        Game::getInstance().requestState("level");
-    }
-}

Deleted: branches/gui/src/orxonox/gamestates/GSGUI.h
===================================================================
--- branches/gui/src/orxonox/gamestates/GSGUI.h	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/gamestates/GSGUI.h	2009-03-25 22:53:04 UTC (rev 2850)
@@ -1,57 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _GSGUI_H__
-#define _GSGUI_H__
-
-#include "OrxonoxPrereqs.h"
-#include "core/GameState.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport GSGUI : public GameState
-    {
-    public:
-        GSGUI(const std::string& name);
-        ~GSGUI();
-
-        void activate();
-        void deactivate();
-        void update(const Clock& time);
-
-        void startGame();
-
-    private:
-        GUIManager* guiManager_;
-
-        // console commands
-        ConsoleCommand* ccStartGame_;
-    };
-}
-
-#endif /* _GSGUI_H__ */

Modified: branches/gui/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- branches/gui/src/orxonox/gamestates/GSGraphics.cc	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/gamestates/GSGraphics.cc	2009-03-25 22:53:04 UTC (rev 2850)
@@ -34,6 +34,7 @@
 
 #include "util/Debug.h"
 #include "core/ConfigValueIncludes.h"
+#include "core/Clock.h"
 #include "core/Core.h"
 #include "core/CoreIncludes.h"
 #include "core/Game.h"
@@ -145,12 +146,14 @@
 
         this->inputManager_->update(time);        // tick console
         this->console_->update(time);
+        this->guiManager_->update(time);
 
         uint64_t timeAfterTick = time.getRealMicroseconds();
 
         // Also add our tick time
         Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);
 
+        // Render
         this->graphicsManager_->update(time);
     }
 

Modified: branches/gui/src/orxonox/gamestates/GSIOConsole.cc
===================================================================
--- branches/gui/src/orxonox/gamestates/GSIOConsole.cc	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/gamestates/GSIOConsole.cc	2009-03-25 22:53:04 UTC (rev 2850)
@@ -52,16 +52,34 @@
 
     void GSIOConsole::activate()
     {
+        {
+            FunctorMember<GSIOConsole>* functor = createFunctor(&GSIOConsole::loadMenu);
+            functor->setObject(this);
+            this->ccLoadMenu_ = createConsoleCommand(functor, "loadMenu");
+            CommandExecutor::addConsoleCommandShortcut(this->ccLoadMenu_);
+        }
     }
 
     void GSIOConsole::deactivate()
     {
+        if (this->ccLoadMenu_)
+        {
+            delete this->ccLoadMenu_;
+            this->ccLoadMenu_ = 0;
+        }
     }
 
     void GSIOConsole::update(const Clock& time)
     {
+        std::cout << ">";
         std::string command;
         std::getline(std::cin, command);
         CommandExecutor::execute(command, true);
     }
+
+    void GSIOConsole::loadMenu()
+    {
+        Game::getInstance().popState();
+        Game::getInstance().requestStates("graphics, mainMenu");
+    }
 }

Modified: branches/gui/src/orxonox/gamestates/GSIOConsole.h
===================================================================
--- branches/gui/src/orxonox/gamestates/GSIOConsole.h	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/gamestates/GSIOConsole.h	2009-03-25 22:53:04 UTC (rev 2850)
@@ -45,7 +45,10 @@
         void update(const Clock& time);
 
     private:
+        void loadMenu();
 
+        // console commands
+        ConsoleCommand* ccLoadMenu_;
     };
 }
 

Modified: branches/gui/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- branches/gui/src/orxonox/gamestates/GSLevel.cc	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/gamestates/GSLevel.cc	2009-03-25 22:53:04 UTC (rev 2850)
@@ -48,6 +48,7 @@
 #include "GraphicsManager.h"
 #include "LevelManager.h"
 #include "PlayerManager.h"
+#include "gui/GUIManager.h"
 
 namespace orxonox
 {
@@ -85,6 +86,13 @@
 
         if (GameMode::showsGraphics())
         {
+            {
+                FunctorMember<GSLevel>* functor = createFunctor(&GSLevel::toggleGUI);
+                functor->setObject(this);
+                this->ccToggleGUI_ = createConsoleCommand(functor, "toggleGUI");
+                CommandExecutor::addConsoleCommandShortcut(this->ccToggleGUI_);
+            }
+
             inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game");
             keyBinder_ = new KeyBinder();
             keyBinder_->loadBindings("keybindings.ini");
@@ -109,9 +117,6 @@
 
         if (GameMode::showsGraphics())
         {
-            // TODO: insert slomo console command with
-            // .accessLevel(AccessLevel::Offline).defaultValue(0, 1.0).axisParamIndex(0).isAxisRelative(false);
-
             // keybind console command
             FunctorMember<GSLevel>* functor1 = createFunctor(&GSLevel::keybind);
             functor1->setObject(this);
@@ -124,6 +129,9 @@
             // set our console command as callback for the key detector
             InputManager::getInstance().setKeyDetectorCallback(std::string("keybind ") + keyDetectorCallbackCode_);
 
+            // InGame GUI test
+            GUIManager::getInstance().showGUI("inGameTest");
+
             // level is loaded: we can start capturing the input
             InputManager::getInstance().requestEnterState("game");
         }
@@ -142,7 +150,13 @@
             delete this->ccTkeybind_;
             this->ccTkeybind_ = 0;
         }
+        if (this->ccToggleGUI_)
+        {
+            delete this->ccToggleGUI_;
+            this->ccToggleGUI_ = 0;
+        }
 
+
         // this call will delete every BaseObject!
         // But currently this will call methods of objects that exist no more
         // The only 'memory leak' is the ParticleSpawer. They would be deleted here
@@ -220,6 +234,14 @@
         delete this->startFile_;
     }
 
+    void GSLevel::toggleGUI()
+    {
+        if (GameMode::showsGraphics())
+        {
+            GUIManager::getInstance().executeCode("toggleGUI()");
+        }
+    }
+
     void GSLevel::keybind(const std::string &command)
     {
         this->keybindInternal(command, false);

Modified: branches/gui/src/orxonox/gamestates/GSLevel.h
===================================================================
--- branches/gui/src/orxonox/gamestates/GSLevel.h	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/gamestates/GSLevel.h	2009-03-25 22:53:04 UTC (rev 2850)
@@ -46,6 +46,8 @@
         void deactivate();
         void update(const Clock& time);
 
+        void toggleGUI();
+
     protected:
         void loadLevel();
         void unloadLevel();
@@ -69,7 +71,7 @@
         // console commands
         ConsoleCommand*       ccKeybind_;
         ConsoleCommand*       ccTkeybind_;
-
+        ConsoleCommand*       ccToggleGUI_;
     };
 }
 

Copied: branches/gui/src/orxonox/gamestates/GSMainMenu.cc (from rev 2848, branches/gui/src/orxonox/gamestates/GSGUI.cc)
===================================================================
--- branches/gui/src/orxonox/gamestates/GSMainMenu.cc	                        (rev 0)
+++ branches/gui/src/orxonox/gamestates/GSMainMenu.cc	2009-03-25 22:53:04 UTC (rev 2850)
@@ -0,0 +1,107 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "GSMainMenu.h"
+
+//#include <OgreViewport.h>
+#include <OgreSceneManager.h>
+#include "core/Clock.h"
+#include "core/ConsoleCommand.h"
+#include "core/Game.h"
+#include "core/input/InputManager.h"
+#include "core/input/SimpleInputState.h"
+#include "gui/GUIManager.h"
+#include "objects/Scene.h"
+#include "GraphicsManager.h"
+
+namespace orxonox
+{
+    AddGameState(GSMainMenu, "mainMenu");
+
+    GSMainMenu::GSMainMenu(const std::string& name)
+        : GameState(name)
+        , inputState_(0)
+    {
+    }
+
+    GSMainMenu::~GSMainMenu()
+    {
+    }
+
+    void GSMainMenu::activate()
+    {
+        inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("mainMenu");
+        inputState_->setHandler(GUIManager::getInstancePtr());
+        inputState_->setJoyStickHandler(&InputManager::EMPTY_HANDLER);
+
+        // create an empty Scene
+        this->scene_ = new Scene(0);
+        // and a Camera
+        this->camera_ = this->scene_->getSceneManager()->createCamera("mainMenu/Camera");
+
+        // show main menu
+        GUIManager::getInstance().showGUI("mainMenu");
+        GUIManager::getInstance().setCamera(this->camera_);
+        GraphicsManager::getInstance().setCamera(this->camera_);
+
+        {
+            FunctorMember<GSMainMenu>* functor = createFunctor(&GSMainMenu::startGame);
+            functor->setObject(this);
+            this->ccStartGame_ = createConsoleCommand(functor, "startGame");
+            CommandExecutor::addConsoleCommandShortcut(this->ccStartGame_);
+        }
+        
+        InputManager::getInstance().requestEnterState("mainMenu");
+    }
+
+    void GSMainMenu::deactivate()
+    {
+        InputManager::getInstance().requestLeaveState("game");
+        InputManager::getInstance().requestDestroyState("game");
+
+        if (this->ccStartGame_)
+        {
+            delete this->ccStartGame_;
+            this->ccStartGame_ = 0;
+        }
+
+        GUIManager::getInstance().executeCode("hideGUI()");
+    }
+
+    void GSMainMenu::update(const Clock& time)
+    {
+    }
+
+    void GSMainMenu::startGame()
+    {
+        // HACK - HACK
+        Game::getInstance().popState();
+        Game::getInstance().requestStates("standalone, level");
+    }
+}

Copied: branches/gui/src/orxonox/gamestates/GSMainMenu.h (from rev 2844, branches/gui/src/orxonox/gamestates/GSGUI.h)
===================================================================
--- branches/gui/src/orxonox/gamestates/GSMainMenu.h	                        (rev 0)
+++ branches/gui/src/orxonox/gamestates/GSMainMenu.h	2009-03-25 22:53:04 UTC (rev 2850)
@@ -0,0 +1,60 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _GSMainMenu_H__
+#define _GSMainMenu_H__
+
+#include "OrxonoxPrereqs.h"
+#include <OgrePrerequisites.h>
+#include "core/GameState.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport GSMainMenu : public GameState
+    {
+    public:
+        GSMainMenu(const std::string& name);
+        ~GSMainMenu();
+
+        void activate();
+        void deactivate();
+        void update(const Clock& time);
+
+        void startGame();
+
+    private:
+        SimpleInputState* inputState_;
+        Scene*            scene_;
+        Ogre::Camera*     camera_;
+
+        // console commands
+        ConsoleCommand* ccStartGame_;
+    };
+}
+
+#endif /* _GSMainMenu_H__ */

Modified: branches/gui/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- branches/gui/src/orxonox/gamestates/GSRoot.cc	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/gamestates/GSRoot.cc	2009-03-25 22:53:04 UTC (rev 2850)
@@ -43,7 +43,12 @@
 namespace orxonox
 {
     AddGameState(GSRoot, "root");
-    SetCommandLineSwitch(startWithConsole);
+    SetCommandLineSwitch(console);
+    // Shortcuts for easy direct loading
+    SetCommandLineSwitch(server);
+    SetCommandLineSwitch(client);
+    SetCommandLineSwitch(dedicated);
+    SetCommandLineSwitch(standalone);
 
     GSRoot::GSRoot(const std::string& name)
         : GameState(name)
@@ -62,7 +67,7 @@
     void GSRoot::activate()
     {
         // reset game speed to normal
-        timeFactor_ = 1.0f;
+        this->timeFactor_ = 1.0f;
 
         {
             // time factor console command
@@ -80,19 +85,43 @@
             CommandExecutor::addConsoleCommandShortcut(this->ccPause_).accessLevel(AccessLevel::Offline);
         }
 
-        // Determine where to start
-        if (CommandLine::getValue("startWithConsole").getBool())
+        // Load level directly?
+        bool loadLevel = false;
+        if (CommandLine::getValue("standalone").getBool())
         {
-            // Start the game in the console
-            Game::getInstance().requestState("ioConsole");
+            Game::getInstance().requestStates("graphics, standalone, level");
+            loadLevel = true;
         }
-        else
+        if (CommandLine::getValue("server").getBool())
         {
-            // Start in GUI main menu
-            Game::getInstance().requestState("graphics");
-            Game::getInstance().requestState("mainMenu");
+            Game::getInstance().requestStates("graphics, server, level");
+            loadLevel = true;
         }
-
+        if (CommandLine::getValue("client").getBool())
+        {
+            Game::getInstance().requestStates("graphics, standalone, level");
+            loadLevel = true;
+        }
+        if (CommandLine::getValue("dedicated").getBool())
+        {
+            Game::getInstance().requestStates("dedicated, level");
+            loadLevel = true;
+        }
+        
+        // Determine where to start
+        if (!loadLevel)
+        {
+            if (CommandLine::getValue("console").getBool())
+            {
+                // Start the game in the console without 3D graphics
+                Game::getInstance().requestState("ioConsole");
+            }
+            else
+            {
+                // Start in GUI mode
+                Game::getInstance().requestStates("graphics, mainMenu");
+            }
+        }
     }
 
     void GSRoot::deactivate()
@@ -112,6 +141,13 @@
 
     void GSRoot::update(const Clock& time)
     {
+        if (this->getActivity().topState)
+        {
+            // This state can not 'survive' on its own.
+            // Load a user interface therefore
+            Game::getInstance().requestState("ioConsole");
+        }
+
         uint64_t timeBeforeTick = time.getRealMicroseconds();
 
         for (ObjectList<TimerBase>::iterator it = ObjectList<TimerBase>::begin(); it; ++it)
@@ -131,7 +167,7 @@
 
         uint64_t timeAfterTick = time.getRealMicroseconds();
 
-        // Also add our tick time to the list in GSRoot
+        // Also add our tick time
         Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);
     }
 

Modified: branches/gui/src/orxonox/gui/GUIManager.cc
===================================================================
--- branches/gui/src/orxonox/gui/GUIManager.cc	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/gui/GUIManager.cc	2009-03-25 22:53:04 UTC (rev 2850)
@@ -35,9 +35,8 @@
 #include "OrxonoxStableHeaders.h"
 #include "GUIManager.h"
 
-#include <boost/filesystem.hpp>
+#include <boost/filesystem/path.hpp>
 #include <OgreRenderWindow.h>
-#include <OgreRoot.h>
 #include <CEGUI.h>
 #include <CEGUIDefaultLogger.h>
 #include <ogreceguirenderer/OgreCEGUIRenderer.h>
@@ -49,10 +48,9 @@
 #endif
 
 #include "util/Exception.h"
-#include "core/input/InputManager.h"
-#include "core/input/SimpleInputState.h"
 #include "core/ConsoleCommand.h"
 #include "core/Core.h"
+#include "core/Clock.h"
 #include "ToluaBindCore.h"
 #include "ToluaBindOrxonox.h"
 
@@ -62,17 +60,10 @@
 
 namespace orxonox
 {
-    SetConsoleCommandShortcut(GUIManager, toggleGUI).keybindMode(KeybindMode::OnPress);
-
     GUIManager* GUIManager::singletonRef_s = 0;
 
     GUIManager::GUIManager()
-        //: emptySceneManager_(0)
-        : backgroundSceneManager_(0)
-        //, emptyCamera_(0)
-        , backgroundCamera_(0)
-        //, viewport_(0)
-        , renderWindow_(0)
+        : renderWindow_(0)
         , guiRenderer_(0)
         , resourceProvider_(0)
         , scriptModule_(0)
@@ -85,20 +76,6 @@
 
     GUIManager::~GUIManager()
     {
-        if (backgroundCamera_)
-            backgroundSceneManager_->destroyCamera(backgroundCamera_);
-
-        if (backgroundSceneManager_)
-        {
-            // We have to make sure the SceneManager is not anymore referenced.
-            // For the case that the target SceneManager was yet another one, it
-            // wouldn't matter anyway since this is the destructor.
-            guiRenderer_->setTargetSceneManager(0);
-            Ogre::Root::getSingleton().destroySceneManager(backgroundSceneManager_);
-        }
-
-        InputManager::getInstance().requestDestroyState("gui");
-
         if (guiSystem_)
             delete guiSystem_;
 
@@ -109,10 +86,6 @@
 	        lua_setglobal(luaState_, "Orxonox");
 	        lua_pushnil(luaState_);
 	        lua_setglobal(luaState_, "Core");
-            // TODO: deleting the script module fails an assertion.
-            // However there is not much we can do about it since it occurs too when
-            // we don't open Core or Orxonox. Might be a CEGUI issue.
-            // The memory leak is not a problem anyway..
             delete scriptModule_;
         }
 
@@ -134,13 +107,6 @@
                 // save the render window
                 renderWindow_ = renderWindow;
 
-                // 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);
-
                 // Note: No SceneManager specified yet
                 this->guiRenderer_ = new OgreCEGUIRenderer(renderWindow_, Ogre::RENDER_QUEUE_OVERLAY, true, 3000);
                 this->resourceProvider_ = guiRenderer_->createResourceProvider();
@@ -165,15 +131,8 @@
                 tolua_Core_open(this->scriptModule_->getLuaState());
                 tolua_Orxonox_open(this->scriptModule_->getLuaState());
 
-                // register us as input handler
-                SimpleInputState* state = InputManager::getInstance().createInputState<SimpleInputState>("gui");
-                state->setHandler(this);
-                state->setJoyStickHandler(&InputManager::EMPTY_HANDLER);
-
-                // load the background scene
-                loadScenes();
-                //CEGUI::KeyEventArgs e;
-                //e.codepoint
+                // initialise the basic lua code
+                loadLuaCode();
             }
             catch (CEGUI::Exception& ex)
             {
@@ -186,66 +145,13 @@
             }
 
             state_ = Ready;
-
         }
 
         return true;
     }
 
-    void GUIManager::loadScene(const std::string& name)
+    void GUIManager::loadLuaCode()
     {
-        if (name.compare("IngameMenu") == 0)
-        {
-            try
-            {
-                /*this->scriptModule_ = new LuaScriptModule();
-                this->luaState_ = this->scriptModule_->getLuaState();
-                this->guiSystem_ = new System(this->guiRenderer_, this->resourceProvider_, 0, this->scriptModule_);
-                tolua_Core_open(this->scriptModule_->getLuaState());
-                tolua_Orxonox_open(this->scriptModule_->getLuaState());
-                */
-                this->scriptModule_->executeScriptFile("loadGUI_2.lua", "GUI");
-            }
-            catch (CEGUI::Exception& ex)
-            {
-#if CEGUI_VERSION_MINOR < 6
-                throw GeneralException(ex.getMessage().c_str());
-#else
-                throw GeneralException(ex.getMessage().c_str(), ex.getLine(),
-                                       ex.getFileName().c_str(), ex.getName().c_str());
-#endif
-            }
-        }
-        else
-        {
-            loadScenes();
-        }
-    }
-
-    void GUIManager::loadScenes()
-    {
-        // first of all, we need to have our own SceneManager for the GUI. The reason
-        // is that we might have multiple viewports when in play mode (e.g. the view of
-        // a camera fixed at the back of the ship). That forces us to create our own
-        // full screen viewport that is on top of all the others, but doesn't clear the
-        // port before rendering, so everything from the GUI gets on top eventually.
-        // 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");
-
-        // 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");
-
-        // Create another SceneManager that enables to display some 3D
-        // scene in the background of the main menu.
-        this->backgroundSceneManager_ = Ogre::Root::getSingleton()
-            .createSceneManager(Ogre::ST_GENERIC, "GUI/BackgroundSceneManager");
-        this->backgroundCamera_ = backgroundSceneManager_->createCamera("GUI/BackgroundCamera");
-
-        // TODO: create something 3D
         try
         {
             this->scriptModule_->executeScriptFile("loadGUI_2.lua", "GUI");
@@ -263,60 +169,30 @@
         }
     }
 
-    void GUIManager::toggleGUI()
+    void GUIManager::update(const Clock& time)
     {
-        //COUT(0) << "********* TOGGLE TOGGLE **********" << std::endl;
-        if (getInstance().scriptModule_->executeScriptGlobal("toggleGUI"))
-            InputManager::getInstance().requestEnterState("gui");
-        else
-            InputManager::getInstance().requestLeaveState("gui");
+        assert(guiSystem_);
+        guiSystem_->injectTimePulse(time.getDeltaTime());
     }
 
+    void GUIManager::executeCode(const std::string& str)
+    {
+        this->scriptModule_->executeString(str);
+    }
+
     void GUIManager::setCamera(Ogre::Camera* camera)
     {
         this->guiRenderer_->setTargetSceneManager(camera->getSceneManager());
     }
 
-    void GUIManager::showGUI(const std::string& name, Ogre::SceneManager* sceneManager)// bool showBackground)
+    void GUIManager::showGUI(const std::string& name)
     {
         if (state_ != Uninitialised)
         {
-            if (state_ == OnDisplay)
-                hideGUI();
-
             COUT(3) << "Loading GUI " << name << std::endl;
             try
             {
-		// COUT (0) << "************* sceneManager: " << sceneManager << std::endl;
-                if (!sceneManager)
-                {
-                    // currently, only an image is loaded. We could do 3D, see loadBackground.
-                    //this->viewport_->setClearEveryFrame(true);
-                    this->guiRenderer_->setTargetSceneManager(this->backgroundSceneManager_);
-                    //this->viewport_->setCamera(this->backgroundCamera_);
-
-                    lua_pushboolean(this->scriptModule_->getLuaState(), true);
-                    lua_setglobal(this->scriptModule_->getLuaState(), "showBackground");
-                }
-                else
-                {
-                    //this->viewport_->setClearEveryFrame(false);
-                    this->guiRenderer_->setTargetSceneManager(sceneManager);
-                    currentSceneManager_ = sceneManager;
-                    //this->viewport_->setCamera(this->emptyCamera_);
-
-                    lua_pushboolean(this->scriptModule_->getLuaState(), false);
-                    lua_setglobal(this->scriptModule_->getLuaState(), "showBackground");
-                }
-
-                lua_pushfstring(this->scriptModule_->getLuaState(), "mainmenu.lua");
-                lua_setglobal(this->scriptModule_->getLuaState(), "filename");
-
-                this->scriptModule_->executeScriptGlobal("showGUI");
-
-                InputManager::getInstance().requestEnterState("gui");
-
-                this->state_ = OnDisplay;
+                this->scriptModule_->executeString(std::string("showGUI(\"") + name + "\")");
             }
             catch (CEGUI::Exception& ex)
             {
@@ -333,28 +209,6 @@
         }
     }
 
-    /*void GUIManager::testFct()
-    {
-        //COUT(0) << "**** " << currentSceneManager_ << std::endl;
-        this->showGUI("IngameMenu", currentSceneManager_);
-    }
-
-    void GUIManager::testOutput(const std::string& str)
-    {
-        COUT(0) << "***" << str << "***" << std::endl;
-    }*/
-
-    void GUIManager::hideGUI()
-    {
-        if (this->state_ != OnDisplay)
-            return;
-        //this->viewport_->setCamera(0);
-        // has no effect since you cannot assign 0 as SceneManager
-        //this->guiRenderer_->setTargetSceneManager(0);
-        this->state_ = Ready;
-        InputManager::getInstance().requestLeaveState("gui");
-    }
-
     void GUIManager::mouseButtonPressed(MouseButtonCode::ByEnum id)
     {
         try

Modified: branches/gui/src/orxonox/gui/GUIManager.h
===================================================================
--- branches/gui/src/orxonox/gui/GUIManager.h	2009-03-25 22:50:23 UTC (rev 2849)
+++ branches/gui/src/orxonox/gui/GUIManager.h	2009-03-25 22:53:04 UTC (rev 2850)
@@ -39,7 +39,6 @@
 #include <CEGUIForwardRefs.h>
 #include <CEGUIInputEvent.h>
 #include <CEGUISystem.h>
-#include "core/Clock.h"
 #include "core/input/InputInterfaces.h"
 
 // Forward declaration
@@ -70,35 +69,22 @@
         ~GUIManager();
 
         bool initialise(Ogre::RenderWindow* renderWindow);
-        void loadScene(const std::string& name);
-        void update(const Clock& time)
-        {
-            assert(guiSystem_);
-            guiSystem_->injectTimePulse(time.getDeltaTime());
-        }
-        void showGUI(const std::string& name, Ogre::SceneManager* sceneManager);// bool showBackground); // tolua_export
-        void hideGUI(); // tolua_export
-        //void testOutput(const std::string& str); // tolua_export
 
-        static void toggleGUI();
+        void update(const Clock& time);
 
+        void showGUI(const std::string& name);
+        void executeCode(const std::string& str);
+
         void setCamera(Ogre::Camera* camera);
-        Ogre::Camera* getCamera() { return this->backgroundCamera_; }
 
-        static void showGUI_s(const std::string& name, Ogre::SceneManager* sceneManager)//bool showBackground)
-        {
-            getInstance().showGUI(name, sceneManager);
-        }
-
-        // please remove
-        //void testFct();
-
         static GUIManager& getInstance()    { assert(singletonRef_s); return *singletonRef_s; } // tolua_export
         static GUIManager* getInstancePtr() { return singletonRef_s; }
 
     private:
         GUIManager(const GUIManager& instance);
 
+        void loadLuaCode();
+
         void keyPressed (const KeyEvent& evt)
         { guiSystem_->injectKeyDown(evt.key); guiSystem_->injectChar(evt.text); }
         void keyReleased(const KeyEvent& evt)
@@ -119,13 +105,6 @@
         void updateKey(float dt) { }
         void updateMouse(float dt) { }
 
-        void loadScenes();
-
-        //Ogre::SceneManager*       emptySceneManager_;
-        Ogre::SceneManager*       backgroundSceneManager_;
-        //Ogre::Camera*             emptyCamera_;
-        Ogre::Camera*             backgroundCamera_;
-        //Ogre::Viewport*           viewport_;
         Ogre::RenderWindow*       renderWindow_;
         CEGUI::OgreCEGUIRenderer* guiRenderer_;
         CEGUI::ResourceProvider*  resourceProvider_;
@@ -134,7 +113,6 @@
         CEGUI::System*            guiSystem_;
         CEGUI::Imageset*          backgroundImage_;
         lua_State*                luaState_;
-        Ogre::SceneManager*         currentSceneManager_;
 
         State state_;
 




More information about the Orxonox-commit mailing list