[Orxonox-commit 827] r3346 - in branches/resource/src: core orxonox orxonox/gamestates orxonox/objects/pickup orxonox/overlays orxonox/tools

rgrieder at orxonox.net rgrieder at orxonox.net
Fri Jul 24 21:37:20 CEST 2009


Author: rgrieder
Date: 2009-07-24 21:37:19 +0200 (Fri, 24 Jul 2009)
New Revision: 3346

Added:
   branches/resource/src/core/GUIManager.cc
   branches/resource/src/core/GUIManager.h
   branches/resource/src/core/GraphicsManager.cc
   branches/resource/src/core/GraphicsManager.h
Removed:
   branches/resource/src/orxonox/GraphicsManager.cc
   branches/resource/src/orxonox/GraphicsManager.h
   branches/resource/src/orxonox/gui/
Modified:
   branches/resource/src/core/CMakeLists.txt
   branches/resource/src/core/CorePrereqs.h
   branches/resource/src/orxonox/CMakeLists.txt
   branches/resource/src/orxonox/CameraManager.cc
   branches/resource/src/orxonox/OrxonoxPrereqs.h
   branches/resource/src/orxonox/gamestates/GSGraphics.cc
   branches/resource/src/orxonox/gamestates/GSLevel.cc
   branches/resource/src/orxonox/gamestates/GSMainMenu.cc
   branches/resource/src/orxonox/objects/pickup/PickupInventory.cc
   branches/resource/src/orxonox/objects/pickup/PickupSpawner.cc
   branches/resource/src/orxonox/overlays/GUIOverlay.cc
   branches/resource/src/orxonox/tools/ParticleInterface.cc
   branches/resource/src/orxonox/tools/Shader.cc
Log:
Moved GraphicsManager and GUIManager to the core. Almost no actual code changes though, just moving (here was that Map-hack I had to move to GSGraphics).

Modified: branches/resource/src/core/CMakeLists.txt
===================================================================
--- branches/resource/src/core/CMakeLists.txt	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/core/CMakeLists.txt	2009-07-24 19:37:19 UTC (rev 3346)
@@ -26,6 +26,8 @@
   Game.cc
   GameMode.cc
   GameState.cc
+  GraphicsManager.cc
+  GUIManager.cc
   Language.cc
   LuaBind.cc
   ObjectListBase.cc
@@ -79,12 +81,15 @@
     CorePrecompiledHeaders.h
   LINK_LIBRARIES
     ${OGRE_LIBRARY}
+    ${Boost_FILESYSTEM_LIBRARY}
+    ${Boost_SYSTEM_LIBRARY} # Filesystem dependency
     ${Boost_THREAD_LIBRARY}
-    ${Boost_FILESYSTEM_LIBRARY}
-    ${Boost_SYSTEM_LIBRARY}
-    ${Boost_DATE_TIME_LIBRARY} # MSVC only
+    ${Boost_DATE_TIME_LIBRARY} # Thread dependency
+    ${CEGUI_LIBRARY}
+    ${CEGUILUA_LIBRARY}
     ${LUA_LIBRARIES}
     cpptcl_orxonox
+    ogreceguirenderer_orxonox
     ois_orxonox
     tinyxml++_orxonox
     tolua++_orxonox

Modified: branches/resource/src/core/CorePrereqs.h
===================================================================
--- branches/resource/src/core/CorePrereqs.h	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/core/CorePrereqs.h	2009-07-24 19:37:19 UTC (rev 3346)
@@ -122,6 +122,8 @@
     template <class T>
     class FunctorMember;
     class FunctorStatic;
+    class GraphicsManager;
+    class GUIManager;
     class Identifier;
     class IRC;
     template <class T>
@@ -143,6 +145,7 @@
     class ObjectListElement;
     template <class T>
     class ObjectListIterator;
+    class OgreWindowEventListener;
     class OrxonoxClass;
     class Shell;
     class ShellListener;
@@ -219,6 +222,21 @@
     class condition_variable;
 }
 
+// CEGUI
+namespace CEGUI
+{
+    class DefaultLogger;
+    class Logger;
+    class LuaScriptModule;
+
+    class OgreCEGUIRenderer;
+    class OgreCEGUIResourceProvider;
+    class OgreCEGUITexture;
+}
+
+// Lua
+struct lua_State;
+
 // TinyXML and TinyXML++
 class TiXmlString;
 class TiXmlOutStream;

Copied: branches/resource/src/core/GUIManager.cc (from rev 3340, branches/resource/src/orxonox/gui/GUIManager.cc)
===================================================================
--- branches/resource/src/core/GUIManager.cc	                        (rev 0)
+++ branches/resource/src/core/GUIManager.cc	2009-07-24 19:37:19 UTC (rev 3346)
@@ -0,0 +1,352 @@
+/*
+ *   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
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ at file
+ at brief
+    Implementation of the GUIManager class.
+*/
+
+#include "GUIManager.h"
+
+#include <memory>
+extern "C" {
+#include <lua.h>
+}
+#include <CEGUIDefaultLogger.h>
+#include <CEGUIExceptions.h>
+#include <CEGUIInputEvent.h>
+#include <CEGUIResourceProvider.h>
+#include <CEGUISystem.h>
+#include <ogreceguirenderer/OgreCEGUIRenderer.h>
+
+#include "SpecialConfig.h" // Configures the macro below
+#ifdef CEGUILUA_USE_INTERNAL_LIBRARY
+#   include <ceguilua/CEGUILua.h>
+#else
+#   include <CEGUILua.h>
+#endif
+
+#include "util/Debug.h"
+#include "util/Exception.h"
+#include "util/OrxAssert.h"
+#include "Core.h"
+#include "Clock.h"
+#include "LuaBind.h"
+
+namespace orxonox
+{
+    class CEGUILogger : public CEGUI::DefaultLogger
+    {
+    public:
+	    void logEvent(const CEGUI::String& message, CEGUI::LoggingLevel level = CEGUI::Standard)
+        {
+            int orxonoxLevel = CEGUI::Standard;
+            switch (level)
+            {
+                case CEGUI::Errors:      orxonoxLevel = 1; break;
+                case CEGUI::Warnings:    orxonoxLevel = 2; break;
+                case CEGUI::Standard:    orxonoxLevel = 4; break;
+                case CEGUI::Informative: orxonoxLevel = 5; break;
+                case CEGUI::Insane:      orxonoxLevel = 6; break;
+                default: OrxAssert(false, "CEGUI log level out of range, inpect immediately!");
+            }
+            OutputHandler::getOutStream().setOutputLevel(orxonoxLevel)
+                << "CEGUI: " << message << std::endl;
+
+            CEGUI::DefaultLogger::logEvent(message, level);
+        }
+    };
+
+    static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button);
+
+    GUIManager* GUIManager::singletonRef_s = 0;
+
+    /**
+    @brief
+        Constructs the GUIManager by starting up CEGUI
+
+        Creates the interface to Ogre, sets up the CEGUI renderer and the Lua script module together with the Lua engine.
+        The log is set up and connected to the CEGUILogger.
+        After Lua setup tolua++-elements are linked to Lua-state to give Lua access to C++-code.
+        Finally initial Lua code is executed (maybe we can do this with the CEGUI startup script automatically).
+    @param renderWindow
+        Ogre's render window. Without this, the GUI cannot be displayed.
+    @return true if success, otherwise false
+    */
+    GUIManager::GUIManager(Ogre::RenderWindow* renderWindow)
+        : renderWindow_(renderWindow)
+        , resourceProvider_(0)
+    {
+        assert(singletonRef_s == 0);
+        singletonRef_s = this;
+
+        using namespace CEGUI;
+
+        COUT(3) << "Initialising CEGUI." << std::endl;
+
+        try
+        {
+            // Note: No SceneManager specified yet
+            guiRenderer_.reset(new OgreCEGUIRenderer(renderWindow_, Ogre::RENDER_QUEUE_OVERLAY, false, 3000));
+            resourceProvider_ = guiRenderer_->createResourceProvider();
+            resourceProvider_->setDefaultResourceGroup("GUI");
+
+            // setup scripting
+            scriptModule_.reset(new LuaScriptModule());
+            luaState_ = scriptModule_->getLuaState();
+
+            // Create our own logger to specify the filepath
+            std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
+            ceguiLogger->setLogFilename(Core::getLogPathString() + "cegui.log");
+            // set the log level according to ours (translate by subtracting 1)
+            ceguiLogger->setLoggingLevel(
+                static_cast<LoggingLevel>(Core::getSoftDebugLevel(OutputHandler::LD_Logfile) - 1));
+            this->ceguiLogger_ = ceguiLogger.release();
+
+            // create the CEGUI system singleton
+            guiSystem_.reset(new System(guiRenderer_.get(), resourceProvider_, 0, scriptModule_.get()));
+
+            // do this after 'new CEGUI::Sytem' because that creates the lua state in the first place
+            LuaBind::getInstance().openToluaInterfaces(this->luaState_);
+
+            // initialise the basic lua code
+            this->loadLuaCode();
+        }
+        catch (CEGUI::Exception& ex)
+        {
+#if CEGUI_VERSION_MAJOR == 0 && 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
+        }
+    }
+
+    /**
+    @brief
+        Destructor of the GUIManager
+
+        Basically shuts down CEGUI (member smart pointers) but first unloads our Tolua modules.
+    */
+    GUIManager::~GUIManager()
+    {
+        // destroy our own tolua interfaces
+        LuaBind::getInstance().closeToluaInterfaces(this->luaState_);
+
+        singletonRef_s = 0;
+    }
+
+    /**
+    @brief
+        Calls main Lua script
+    @todo
+        This function calls the main Lua script for our GUI.
+
+        Additionally we set the datapath variable in Lua. This is needed so Lua can access the data used for the GUI.
+    */
+    void GUIManager::loadLuaCode()
+    {
+        // set datapath for GUI data
+        lua_pushfstring(this->scriptModule_->getLuaState(), Core::getMediaPathString().c_str());
+        lua_setglobal(this->scriptModule_->getLuaState(), "datapath");
+        // call main Lua script
+        this->scriptModule_->executeScriptFile("loadGUI_3.lua", "GUI");
+    }
+
+    /**
+    @brief
+        used to tick the GUI
+    @param time
+        clock which provides time value for the GUI System
+
+        Ticking the GUI means updating it with a certain regularity.
+        The elapsed time since the last call is given in the time value provided by the clock.
+        This time value is then used to provide a fluent animation of the GUI.
+    */
+    void GUIManager::update(const Clock& time)
+    {
+        assert(guiSystem_);
+        guiSystem_->injectTimePulse(time.getDeltaTime());
+    }
+
+    /**
+    @brief
+        Tells the GUIManager which SceneManager to use
+    @param camera
+        The current camera on which the GUI should be displayed on.
+
+        In fact the GUIManager needs the SceneManager and not the Camera to display the GUI.
+        This means the GUI is not bound to a camera but rather to the SceneManager.
+        Hiding the GUI when needed can therefore not be resolved by just NOT setting the current camera.
+    */
+    void GUIManager::setCamera(Ogre::Camera* camera)
+    {
+        if (camera == NULL)
+            this->guiRenderer_->setTargetSceneManager(0);
+        else
+            this->guiRenderer_->setTargetSceneManager(camera->getSceneManager());
+    }
+
+    /**
+    @brief
+        Executes Lua code
+    @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)
+    {
+        try
+        {
+            this->scriptModule_->executeString(str);
+        }
+        catch (const CEGUI::Exception& ex)
+        {
+            COUT(2) << "CEGUI Error: \"" << ex.getMessage() << "\" while executing code \"" << str << "\"" << std::endl;
+        }
+        catch (...)
+        {
+            COUT(2) << "Couldn't execute GUI related Lua code due to unknown reasons." << std::endl;
+        }
+    }
+
+    /**
+    @brief
+        Displays specified GUI on screen
+    @param name
+        The name of the GUI
+
+        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)
+    {
+        this->executeCode(std::string("showGUI(\"") + name + "\")");
+    }
+
+    void GUIManager::keyPressed(const KeyEvent& evt)
+    {
+        guiSystem_->injectKeyDown(evt.getKeyCode());
+        guiSystem_->injectChar(evt.getText());
+    }
+    void GUIManager::keyReleased(const KeyEvent& evt)
+    {
+        guiSystem_->injectKeyUp(evt.getKeyCode());
+    }
+
+    /**
+    @brief
+        Function receiving a mouse button pressed event.
+    @param id
+        ID of the mouse button which got pressed
+
+        This function is inherited by MouseHandler and injects the event into CEGUI.
+        It is for CEGUI to process the event.
+    */
+    void GUIManager::buttonPressed(MouseButtonCode::ByEnum id)
+    {
+        try
+        {
+            guiSystem_->injectMouseButtonDown(convertButton(id));
+        }
+        catch (CEGUI::ScriptException& ex)
+        {
+            // We simply ignore the exception and proceed
+            COUT(1) << ex.getMessage() << std::endl;
+        }
+    }
+
+    /**
+    @brief
+        Function receiving a mouse button released event.
+    @param id
+        ID of the mouse button which got released
+
+        This function is inherited by MouseHandler and injects the event into CEGUI.
+        It is for CEGUI to process the event.
+    */
+    void GUIManager::buttonReleased(MouseButtonCode::ByEnum id)
+    {
+        try
+        {
+            guiSystem_->injectMouseButtonUp(convertButton(id));
+        }
+        catch (CEGUI::ScriptException& ex)
+        {
+            // We simply ignore the exception and proceed
+            COUT(1) << ex.getMessage() << std::endl;
+        }
+    }
+
+    void GUIManager::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
+    {
+        guiSystem_->injectMouseMove(static_cast<float>(rel.x), static_cast<float>(rel.y));
+    }
+    void GUIManager::mouseScrolled(int abs, int rel)
+    {
+        guiSystem_->injectMouseWheelChange(static_cast<float>(rel));
+    }
+
+    /**
+    @brief
+        converts mouse event code to CEGUI event code
+    @param button
+        code of the mouse button as we use it in Orxonox
+    @return
+        code of the mouse button as it is used by CEGUI
+
+        Simple convertion from mouse event code in Orxonox to the one used in CEGUI.
+     */
+    static inline CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button)
+    {
+        switch (button)
+        {
+        case MouseButtonCode::Left:
+            return CEGUI::LeftButton;
+
+        case MouseButtonCode::Right:
+            return CEGUI::RightButton;
+
+        case MouseButtonCode::Middle:
+            return CEGUI::MiddleButton;
+
+        case MouseButtonCode::Button3:
+            return CEGUI::X1Button;
+
+        case MouseButtonCode::Button4:
+            return CEGUI::X2Button;
+
+        default:
+            return CEGUI::NoButton;
+        }
+    }
+}

Copied: branches/resource/src/core/GUIManager.h (from rev 3339, branches/resource/src/orxonox/gui/GUIManager.h)
===================================================================
--- branches/resource/src/core/GUIManager.h	                        (rev 0)
+++ branches/resource/src/core/GUIManager.h	2009-07-24 19:37:19 UTC (rev 3346)
@@ -0,0 +1,106 @@
+/*
+ *   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
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ at file
+ at brief
+    Declaration of the GUIManager class.
+*/
+
+#ifndef _GUIManager_H__
+#define _GUIManager_H__
+
+#include "CorePrereqs.h"
+
+#include <map>
+#include <string>
+#include <CEGUIForwardRefs.h>
+#include <boost/scoped_ptr.hpp>
+
+#include "util/OgreForwardRefs.h"
+#include "input/InputHandler.h"
+
+namespace orxonox
+{
+    /**
+    @class GUIManager
+    @brief
+        Provides a simple interface to CEGUI with tolua methods and console commands. It also acts as a key and mouse handler.
+
+        The GUIManager is a singleton and can be called anywhere when access on the GUI is needed.
+        Creation of the GUIManager is therefore not possible and the cunstructor is private.
+
+        Since the GUI needs user input, the GUIManager implements the functions needed to act as a key and/or mouse handler.
+        Those input events are then injected into CEGUI in Lua.
+    */
+    class _CoreExport GUIManager : public InputHandler
+    {
+    public:
+        GUIManager(Ogre::RenderWindow* renderWindow);
+        ~GUIManager();
+
+        void update(const Clock& time);
+
+        void showGUI(const std::string& name);
+        void executeCode(const std::string& str);
+
+        void setCamera(Ogre::Camera* camera);
+
+        static GUIManager& getInstance()    { assert(singletonRef_s); return *singletonRef_s; }
+        static GUIManager* getInstancePtr() { return singletonRef_s; }
+
+    private:
+        GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class)
+
+        void loadLuaCode();
+
+        // keyHandler functions
+        void keyPressed (const KeyEvent& evt);
+        void keyReleased(const KeyEvent& evt);
+
+        // mouseHandler functions
+        void buttonPressed (MouseButtonCode::ByEnum id);
+        void buttonReleased(MouseButtonCode::ByEnum id);
+        void mouseMoved    (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
+        void mouseScrolled (int abs, int rel);
+
+        boost::scoped_ptr<CEGUI::OgreCEGUIRenderer> guiRenderer_;  //!< CEGUI's interface to the Ogre Engine
+        boost::scoped_ptr<CEGUI::LuaScriptModule>   scriptModule_; //!< CEGUI's script module to use Lua
+        boost::scoped_ptr<CEGUI::System>            guiSystem_;    //!< CEGUI's main system
+        Ogre::RenderWindow*      renderWindow_;     //!< Ogre's render window to give CEGUI access to it
+        CEGUI::ResourceProvider* resourceProvider_; //!< CEGUI's resource provider
+        CEGUI::Logger*           ceguiLogger_;      //!< CEGUI's logger to be able to log CEGUI errors in our log
+        lua_State*               luaState_;         //!< Lua state, access point to the Lua engine
+
+        static GUIManager*       singletonRef_s;    //!< Singleton reference to GUIManager
+
+    };
+}
+
+#endif /* _GUIManager_H__ */

Copied: branches/resource/src/core/GraphicsManager.cc (from rev 3338, branches/resource/src/orxonox/GraphicsManager.cc)
===================================================================
--- branches/resource/src/core/GraphicsManager.cc	                        (rev 0)
+++ branches/resource/src/core/GraphicsManager.cc	2009-07-24 19:37:19 UTC (rev 3346)
@@ -0,0 +1,413 @@
+/*
+ *   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
+ *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
+ *   Co-authors:
+ *      Felix Schulthess
+ *
+ */
+
+/**
+ at file
+ at brief
+    Implementation of an partial interface to Ogre.
+*/
+
+#include "GraphicsManager.h"
+
+#include <fstream>
+#include <memory>
+#include <boost/filesystem.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include <OgreCompositorManager.h>
+#include <OgreConfigFile.h>
+#include <OgreFrameListener.h>
+#include <OgreRoot.h>
+#include <OgreLogManager.h>
+#include <OgreException.h>
+#include <OgreRenderWindow.h>
+#include <OgreRenderSystem.h>
+#include <OgreTextureManager.h>
+#include <OgreViewport.h>
+#include <OgreWindowEventUtilities.h>
+
+#include "SpecialConfig.h"
+#include "util/Exception.h"
+#include "util/StringUtils.h"
+#include "util/SubString.h"
+#include "Clock.h"
+#include "ConsoleCommand.h"
+#include "ConfigValueIncludes.h"
+#include "CoreIncludes.h"
+#include "Core.h"
+#include "Game.h"
+#include "GameMode.h"
+#include "WindowEventListener.h"
+
+namespace orxonox
+{
+    using boost::shared_ptr;
+
+    class OgreWindowEventListener : public Ogre::WindowEventListener
+    {
+    public:
+        void windowResized     (Ogre::RenderWindow* rw)
+            { orxonox::WindowEventListener::resizeWindow(rw->getWidth(), rw->getHeight()); }
+        void windowFocusChange (Ogre::RenderWindow* rw)
+            { orxonox::WindowEventListener::changeWindowFocus(); }
+        void windowClosed      (Ogre::RenderWindow* rw)
+            { orxonox::Game::getInstance().stop(); }
+        void windowMoved       (Ogre::RenderWindow* rw)
+            { orxonox::WindowEventListener::moveWindow(); }
+    };
+
+    GraphicsManager* GraphicsManager::singletonRef_s = 0;
+
+    /**
+    @brief
+        Non-initialising constructor.
+    */
+    GraphicsManager::GraphicsManager()
+        : ogreRoot_(0)
+        , ogreLogger_(0)
+        , renderWindow_(0)
+        , viewport_(0)
+        , ogreWindowEventListener_(new OgreWindowEventListener())
+    {
+        RegisterObject(GraphicsManager);
+
+        assert(singletonRef_s == 0);
+        singletonRef_s = this;
+
+        this->setConfigValues();
+
+        // Ogre setup procedure
+        setupOgre();
+
+        try
+        {
+            // load all the required plugins for Ogre
+            loadOgrePlugins();
+            // read resource declaration file
+            this->declareResources();
+            // Reads ogre config and creates the render window
+            this->loadRenderer();
+
+            // TODO: Spread this
+            this->initialiseResources();
+
+            // add console commands
+            FunctorMember<GraphicsManager>* functor1 = createFunctor(&GraphicsManager::printScreen);
+            functor1->setObject(this);
+            ccPrintScreen_ = createConsoleCommand(functor1, "printScreen");
+            CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_);
+        }
+        catch (...)
+        {
+            // clean up
+            delete this->ogreRoot_;
+            delete this->ogreLogger_;
+            delete this->ogreWindowEventListener_;
+            throw;
+        }
+    }
+
+    /**
+    @brief
+        Destroys all the Ogre related objects
+    */
+    GraphicsManager::~GraphicsManager()
+    {
+/*
+        delete this->ccPrintScreen_;
+*/
+
+        // unload all compositors (this is only necessary because we don't yet destroy all resources!)
+        Ogre::CompositorManager::getSingleton().removeAll();
+
+        // Delete OGRE main control organ
+        delete this->ogreRoot_;
+
+        // delete the logManager (since we have created it in the first place).
+        delete this->ogreLogger_;
+
+        delete this->ogreWindowEventListener_;
+
+        assert(singletonRef_s);
+        singletonRef_s = 0;
+    }
+
+    void GraphicsManager::setConfigValues()
+    {
+        SetConfigValue(resourceFile_,    "resources.cfg")
+            .description("Location of the resources file in the data path.");
+        SetConfigValue(ogreConfigFile_,  "ogre.cfg")
+            .description("Location of the Ogre config file");
+        SetConfigValue(ogrePluginsFolder_, ORXONOX_OGRE_PLUGINS_FOLDER)
+            .description("Folder where the Ogre plugins are located.");
+        SetConfigValue(ogrePlugins_, ORXONOX_OGRE_PLUGINS)
+            .description("Comma separated list of all plugins to load.");
+        SetConfigValue(ogreLogFile_,     "ogre.log")
+            .description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");
+        SetConfigValue(ogreLogLevelTrivial_ , 5)
+            .description("Corresponding orxonox debug level for ogre Trivial");
+        SetConfigValue(ogreLogLevelNormal_  , 4)
+            .description("Corresponding orxonox debug level for ogre Normal");
+        SetConfigValue(ogreLogLevelCritical_, 2)
+            .description("Corresponding orxonox debug level for ogre Critical");
+    }
+
+    void GraphicsManager::update(const Clock& time)
+    {
+        Ogre::FrameEvent evt;
+        evt.timeSinceLastFrame = time.getDeltaTime();
+        evt.timeSinceLastEvent = time.getDeltaTime(); // note: same time, but shouldn't matter anyway
+
+        // don't forget to call _fireFrameStarted to OGRE to make sure
+        // everything goes smoothly
+        ogreRoot_->_fireFrameStarted(evt);
+
+        // Pump messages in all registered RenderWindows
+        // This calls the WindowEventListener objects.
+        Ogre::WindowEventUtilities::messagePump();
+        // make sure the window stays active even when not focused
+        // (probably only necessary on windows)
+        this->renderWindow_->setActive(true);
+
+        // render
+        ogreRoot_->_updateAllRenderTargets();
+
+        // again, just to be sure OGRE works fine
+        ogreRoot_->_fireFrameEnded(evt); // note: uses the same time as _fireFrameStarted
+    }
+
+    void GraphicsManager::setCamera(Ogre::Camera* camera)
+    {
+        this->viewport_->setCamera(camera);
+    }
+
+    /**
+    @brief
+        Creates the Ogre Root object and sets up the ogre log.
+    */
+    void GraphicsManager::setupOgre()
+    {
+        COUT(3) << "Setting up Ogre..." << std::endl;
+
+        if (ogreConfigFile_ == "")
+        {
+            COUT(2) << "Warning: Ogre config file set to \"\". Defaulting to config.cfg" << std::endl;
+            ModifyConfigValue(ogreConfigFile_, tset, "config.cfg");
+        }
+        if (ogreLogFile_ == "")
+        {
+            COUT(2) << "Warning: Ogre log file set to \"\". Defaulting to ogre.log" << std::endl;
+            ModifyConfigValue(ogreLogFile_, tset, "ogre.log");
+        }
+
+        boost::filesystem::path ogreConfigFilepath(Core::getConfigPath() / this->ogreConfigFile_);
+        boost::filesystem::path ogreLogFilepath(Core::getLogPath() / this->ogreLogFile_);
+
+        // create a new logManager
+        // Ogre::Root will detect that we've already created a Log
+        std::auto_ptr<Ogre::LogManager> logger(new Ogre::LogManager());
+        COUT(4) << "Ogre LogManager created" << std::endl;
+
+        // create our own log that we can listen to
+        Ogre::Log *myLog;
+        myLog = logger->createLog(ogreLogFilepath.string(), true, false, false);
+        COUT(4) << "Ogre Log created" << std::endl;
+
+        myLog->setLogDetail(Ogre::LL_BOREME);
+        myLog->addListener(this);
+
+        COUT(4) << "Creating Ogre Root..." << std::endl;
+
+        // check for config file existence because Ogre displays (caught) exceptions if not
+        if (!boost::filesystem::exists(ogreConfigFilepath))
+        {
+            // create a zero sized file
+            std::ofstream creator;
+            creator.open(ogreConfigFilepath.string().c_str());
+            creator.close();
+        }
+
+        // Leave plugins file empty. We're going to do that part manually later
+        ogreRoot_ = new Ogre::Root("", ogreConfigFilepath.string(), ogreLogFilepath.string());
+        // In case that new Root failed the logger gets destroyed because of the std::auto_ptr
+        ogreLogger_ = logger.release();
+
+        COUT(3) << "Ogre set up done." << std::endl;
+    }
+
+    void GraphicsManager::loadOgrePlugins()
+    {
+        // just to make sure the next statement doesn't segfault
+        if (ogrePluginsFolder_ == "")
+            ogrePluginsFolder_ = ".";
+
+        boost::filesystem::path folder(ogrePluginsFolder_);
+        // Do some SubString magic to get the comma separated list of plugins
+        SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '(', ')', false, '\0');
+        // Use backslash paths on Windows! file_string() already does that though.
+        for (unsigned int i = 0; i < plugins.size(); ++i)
+            ogreRoot_->loadPlugin((folder / plugins[i]).file_string());
+    }
+
+    void GraphicsManager::declareResources()
+    {
+        CCOUT(4) << "Declaring Resources" << std::endl;
+        //TODO: Specify layout of data file and maybe use xml-loader
+        //TODO: Work with ressource groups (should be generated by a special loader)
+
+        if (resourceFile_ == "")
+        {
+            COUT(2) << "Warning: Ogre resource file set to \"\". Defaulting to resources.cfg" << std::endl;
+            ModifyConfigValue(resourceFile_, tset, "resources.cfg");
+        }
+
+        // Load resource paths from data file using configfile ressource type
+        Ogre::ConfigFile cf;
+        try
+        {
+            cf.load((Core::getMediaPath() / resourceFile_).string());
+        }
+        catch (...)
+        {
+            //COUT(1) << ex.getFullDescription() << std::endl;
+            COUT(0) << "Have you forgotten to set the data path in orxnox.ini?" << std::endl;
+            throw;
+        }
+
+        // Go through all sections & settings in the file
+        Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
+
+        std::string secName, typeName, archName;
+        while (seci.hasMoreElements())
+        {
+            try
+            {
+                secName = seci.peekNextKey();
+                Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
+                Ogre::ConfigFile::SettingsMultiMap::iterator i;
+                for (i = settings->begin(); i != settings->end(); ++i)
+                {
+                    typeName = i->first; // for instance "FileSystem" or "Zip"
+                    archName = i->second; // name (and location) of archive
+
+                    Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
+                        (Core::getMediaPath() / archName).string(), typeName, secName);
+                }
+            }
+            catch (Ogre::Exception& ex)
+            {
+                COUT(1) << ex.getFullDescription() << std::endl;
+            }
+        }
+    }
+
+    void GraphicsManager::loadRenderer()
+    {
+        CCOUT(4) << "Configuring Renderer" << std::endl;
+
+        if (!ogreRoot_->restoreConfig())
+            if (!ogreRoot_->showConfigDialog())
+                ThrowException(InitialisationFailed, "OGRE graphics configuration dialogue failed.");
+
+        CCOUT(4) << "Creating render window" << std::endl;
+
+        this->renderWindow_ = ogreRoot_->initialise(true, "Orxonox");
+        this->ogreWindowEventListener_->windowResized(renderWindow_);
+
+        Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, ogreWindowEventListener_);
+
+        Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(0);
+
+        // create a full screen default viewport
+        this->viewport_ = this->renderWindow_->addViewport(0, 0);
+    }
+
+    void GraphicsManager::initialiseResources()
+    {
+        CCOUT(4) << "Initialising resources" << std::endl;
+        //TODO: Do NOT load all the groups, why are we doing that? And do we really do that? initialise != load...
+        //try
+        //{
+            Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+            /*Ogre::StringVector str = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
+            for (unsigned int i = 0; i < str.size(); i++)
+            {
+            Ogre::ResourceGroupManager::getSingleton().loadResourceGroup(str[i]);
+            }*/
+        //}
+        //catch (...)
+        //{
+        //    CCOUT(2) << "Error: There was a serious error when initialising the resources." << std::endl;
+        //    throw;
+        //}
+    }
+
+    /**
+    @brief
+        Method called by the LogListener interface from Ogre.
+        We use it to capture Ogre log messages and handle it ourselves.
+    @param message
+        The message to be logged
+    @param lml
+        The message level the log is using
+    @param maskDebug
+        If we are printing to the console or not
+    @param logName
+        The name of this log (so you can have several listeners
+        for different logs, and identify them)
+    */
+    void GraphicsManager::messageLogged(const std::string& message,
+        Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName)
+    {
+        int orxonoxLevel;
+        switch (lml)
+        {
+        case Ogre::LML_TRIVIAL:
+            orxonoxLevel = this->ogreLogLevelTrivial_;
+            break;
+        case Ogre::LML_NORMAL:
+            orxonoxLevel = this->ogreLogLevelNormal_;
+            break;
+        case Ogre::LML_CRITICAL:
+            orxonoxLevel = this->ogreLogLevelCritical_;
+            break;
+        default:
+            orxonoxLevel = 0;
+        }
+        OutputHandler::getOutStream().setOutputLevel(orxonoxLevel)
+            << "Ogre: " << message << std::endl;
+    }
+
+    void GraphicsManager::printScreen()
+    {
+        assert(this->renderWindow_);
+       
+        this->renderWindow_->writeContentsToTimestampedFile(Core::getLogPathString() + "screenShot_", ".jpg");
+    }
+}

Copied: branches/resource/src/core/GraphicsManager.h (from rev 3336, branches/resource/src/orxonox/GraphicsManager.h)
===================================================================
--- branches/resource/src/core/GraphicsManager.h	                        (rev 0)
+++ branches/resource/src/core/GraphicsManager.h	2009-07-24 19:37:19 UTC (rev 3346)
@@ -0,0 +1,113 @@
+/*
+ *   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
+ *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
+ *   Co-authors:
+ *      Felix Schulthess
+ *
+ */
+
+/**
+ at file
+ at brief
+    Declaration of GraphicsManager Singleton.
+ */
+
+#ifndef _GraphicsManager_H__
+#define _GraphicsManager_H__
+
+#include "CorePrereqs.h"
+
+#include <cassert>
+#include <string>
+#include <OgreLog.h>
+#include "OrxonoxClass.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Graphics engine manager class
+    */
+    class _CoreExport GraphicsManager : public OrxonoxClass, public Ogre::LogListener
+    {
+    public:
+        GraphicsManager();
+        ~GraphicsManager();
+
+        void setConfigValues();
+
+        void update(const Clock& time);
+
+        inline Ogre::Viewport* getViewport()
+            { return this->viewport_; }
+        inline Ogre::RenderWindow* getRenderWindow()
+            { return this->renderWindow_; }
+
+        void setCamera(Ogre::Camera* camera);
+
+        inline static GraphicsManager& getInstance()
+            { assert(singletonRef_s); return *singletonRef_s; }
+
+    private:
+        GraphicsManager(GraphicsManager&); // don't mess with singletons
+
+        // OGRE initialisation
+        void setupOgre();
+        void loadOgrePlugins();
+        void declareResources();
+        void loadRenderer();
+        void initialiseResources();
+
+        // event from Ogre::LogListener
+        void messageLogged(const std::string& message, Ogre::LogMessageLevel lml,
+            bool maskDebug, const std::string& logName);
+
+        // console commands
+        void printScreen();
+
+    private:
+        Ogre::Root*         ogreRoot_;                 //!< Ogre's root
+        Ogre::LogManager*   ogreLogger_;
+        Ogre::RenderWindow* renderWindow_;             //!< the one and only render window
+        Ogre::Viewport*     viewport_;                 //!< default full size viewport
+        OgreWindowEventListener* ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h
+
+        // config values
+        std::string         resourceFile_;             //!< resources file name
+        std::string         ogreConfigFile_;           //!< ogre config file name
+        std::string         ogrePluginsFolder_;        //!< Folder where the Ogre plugins are located
+        std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
+        std::string         ogreLogFile_;              //!< log file name for Ogre log messages
+        int                 ogreLogLevelTrivial_;      //!< Corresponding Orxonx debug level for LL_TRIVIAL
+        int                 ogreLogLevelNormal_;       //!< Corresponding Orxonx debug level for LL_NORMAL
+        int                 ogreLogLevelCritical_;     //!< Corresponding Orxonx debug level for LL_CRITICAL
+
+        // console commands
+        ConsoleCommand*     ccPrintScreen_;
+
+        static GraphicsManager* singletonRef_s;        //!< Pointer to the Singleton
+    };
+}
+
+#endif /* _GraphicsManager_H__ */

Modified: branches/resource/src/orxonox/CMakeLists.txt
===================================================================
--- branches/resource/src/orxonox/CMakeLists.txt	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/orxonox/CMakeLists.txt	2009-07-24 19:37:19 UTC (rev 3346)
@@ -19,14 +19,12 @@
 
 SET_SOURCE_FILES(ORXONOX_SRC_FILES
   CameraManager.cc
-  GraphicsManager.cc
   LevelManager.cc
   Main.cc
   PawnManager.cc
   PlayerManager.cc
 )
 ADD_SUBDIRECTORY(gamestates)
-ADD_SUBDIRECTORY(gui)
 ADD_SUBDIRECTORY(interfaces)
 ADD_SUBDIRECTORY(objects)
 ADD_SUBDIRECTORY(overlays)
@@ -42,7 +40,6 @@
   FIND_HEADER_FILES
   TOLUA_FILES
     LevelManager.h
-    gui/GUIManager.h
     objects/pickup/BaseItem.h
     objects/pickup/PickupInventory.h
     objects/quest/QuestDescription.h
@@ -52,17 +49,16 @@
   # When defined as WIN32 this removes the console window on Windows
   ${ORXONOX_WIN32}
   LINK_LIBRARIES
+    ${Boost_FILESYSTEM_LIBRARY}
+    ${Boost_SYSTEM_LIBRARY} # Filesystem dependency
+    ${Boost_THREAD_LIBRARY}
+    ${Boost_DATE_TIME_LIBRARY} # Thread dependency
     ${OGRE_LIBRARY}
-    ${CEGUI_LIBRARY}
-    ${LUA_LIBRARIES}
-    ${CEGUILUA_LIBRARY}
-    ${Boost_SYSTEM_LIBRARY}
     ${OPENAL_LIBRARY}
     ${ALUT_LIBRARY}
     ${VORBISFILE_LIBRARY}
     ${VORBIS_LIBRARY}
     ${OGG_LIBRARY}
-    ogreceguirenderer_orxonox
     tinyxml++_orxonox
     tolua++_orxonox
     bullet_orxonox

Modified: branches/resource/src/orxonox/CameraManager.cc
===================================================================
--- branches/resource/src/orxonox/CameraManager.cc	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/orxonox/CameraManager.cc	2009-07-24 19:37:19 UTC (rev 3346)
@@ -33,11 +33,11 @@
 
 #include "util/StringUtils.h"
 #include "core/GameMode.h"
+#include "core/GUIManager.h"
 #include "core/ObjectList.h"
 #include "tools/Shader.h"
 #include "objects/worldentities/Camera.h"
 #include "objects/Scene.h"
-#include "gui/GUIManager.h"
 
 namespace orxonox
 {

Deleted: branches/resource/src/orxonox/GraphicsManager.cc
===================================================================
--- branches/resource/src/orxonox/GraphicsManager.cc	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/orxonox/GraphicsManager.cc	2009-07-24 19:37:19 UTC (rev 3346)
@@ -1,419 +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
- *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
- *   Co-authors:
- *      Felix Schulthess
- *
- */
-
-/**
- at file
- at brief
-    Implementation of an partial interface to Ogre.
-*/
-
-#include "GraphicsManager.h"
-
-#include <fstream>
-#include <memory>
-#include <boost/filesystem.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include <OgreCompositorManager.h>
-#include <OgreConfigFile.h>
-#include <OgreFrameListener.h>
-#include <OgreRoot.h>
-#include <OgreLogManager.h>
-#include <OgreException.h>
-#include <OgreRenderWindow.h>
-#include <OgreRenderSystem.h>
-#include <OgreTextureManager.h>
-#include <OgreViewport.h>
-#include <OgreWindowEventUtilities.h>
-
-#include "SpecialConfig.h"
-#include "util/Exception.h"
-#include "util/StringUtils.h"
-#include "util/SubString.h"
-#include "core/Clock.h"
-#include "core/ConsoleCommand.h"
-#include "core/ConfigValueIncludes.h"
-#include "core/CoreIncludes.h"
-#include "core/Core.h"
-#include "core/Game.h"
-#include "core/GameMode.h"
-#include "core/WindowEventListener.h"
-#include "tools/ParticleInterface.h"
-
-// HACK!
-#include "overlays/map/Map.h"
-
-namespace orxonox
-{
-    using boost::shared_ptr;
-
-    class OgreWindowEventListener : public Ogre::WindowEventListener
-    {
-    public:
-        void windowResized     (Ogre::RenderWindow* rw)
-            { orxonox::WindowEventListener::resizeWindow(rw->getWidth(), rw->getHeight()); }
-        void windowFocusChange (Ogre::RenderWindow* rw)
-            { orxonox::WindowEventListener::changeWindowFocus(); }
-        void windowClosed      (Ogre::RenderWindow* rw)
-            { orxonox::Game::getInstance().stop(); }
-        void windowMoved       (Ogre::RenderWindow* rw)
-            { orxonox::WindowEventListener::moveWindow(); }
-    };
-
-    GraphicsManager* GraphicsManager::singletonRef_s = 0;
-
-    /**
-    @brief
-        Non-initialising constructor.
-    */
-    GraphicsManager::GraphicsManager()
-        : ogreRoot_(0)
-        , ogreLogger_(0)
-        , renderWindow_(0)
-        , viewport_(0)
-        , ogreWindowEventListener_(new OgreWindowEventListener())
-    {
-        RegisterObject(GraphicsManager);
-
-        assert(singletonRef_s == 0);
-        singletonRef_s = this;
-
-        this->setConfigValues();
-
-        // Ogre setup procedure
-        setupOgre();
-
-        try
-        {
-            // load all the required plugins for Ogre
-            loadOgrePlugins();
-            // read resource declaration file
-            this->declareResources();
-            // Reads ogre config and creates the render window
-            this->loadRenderer();
-
-            // TODO: Spread this
-            this->initialiseResources();
-
-            // add console commands
-            FunctorMember<GraphicsManager>* functor1 = createFunctor(&GraphicsManager::printScreen);
-            functor1->setObject(this);
-            ccPrintScreen_ = createConsoleCommand(functor1, "printScreen");
-            CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_);
-        }
-        catch (...)
-        {
-            // clean up
-            delete this->ogreRoot_;
-            delete this->ogreLogger_;
-            delete this->ogreWindowEventListener_;
-            throw;
-        }
-    }
-
-    /**
-    @brief
-        Destroys all the Ogre related objects
-    */
-    GraphicsManager::~GraphicsManager()
-    {
-/*
-        delete this->ccPrintScreen_;
-*/
-
-        // HACK! This fixes an exit crash
-        Map::hackDestroyMap();
-        // unload all compositors (this is only necessary because we don't yet destroy all resources!)
-        Ogre::CompositorManager::getSingleton().removeAll();
-
-        // Delete OGRE main control organ
-        delete this->ogreRoot_;
-
-        // delete the logManager (since we have created it in the first place).
-        delete this->ogreLogger_;
-
-        delete this->ogreWindowEventListener_;
-
-        assert(singletonRef_s);
-        singletonRef_s = 0;
-    }
-
-    void GraphicsManager::setConfigValues()
-    {
-        SetConfigValue(resourceFile_,    "resources.cfg")
-            .description("Location of the resources file in the data path.");
-        SetConfigValue(ogreConfigFile_,  "ogre.cfg")
-            .description("Location of the Ogre config file");
-        SetConfigValue(ogrePluginsFolder_, ORXONOX_OGRE_PLUGINS_FOLDER)
-            .description("Folder where the Ogre plugins are located.");
-        SetConfigValue(ogrePlugins_, ORXONOX_OGRE_PLUGINS)
-            .description("Comma separated list of all plugins to load.");
-        SetConfigValue(ogreLogFile_,     "ogre.log")
-            .description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");
-        SetConfigValue(ogreLogLevelTrivial_ , 5)
-            .description("Corresponding orxonox debug level for ogre Trivial");
-        SetConfigValue(ogreLogLevelNormal_  , 4)
-            .description("Corresponding orxonox debug level for ogre Normal");
-        SetConfigValue(ogreLogLevelCritical_, 2)
-            .description("Corresponding orxonox debug level for ogre Critical");
-    }
-
-    void GraphicsManager::update(const Clock& time)
-    {
-        Ogre::FrameEvent evt;
-        evt.timeSinceLastFrame = time.getDeltaTime();
-        evt.timeSinceLastEvent = time.getDeltaTime(); // note: same time, but shouldn't matter anyway
-
-        // don't forget to call _fireFrameStarted to OGRE to make sure
-        // everything goes smoothly
-        ogreRoot_->_fireFrameStarted(evt);
-
-        // Pump messages in all registered RenderWindows
-        // This calls the WindowEventListener objects.
-        Ogre::WindowEventUtilities::messagePump();
-        // make sure the window stays active even when not focused
-        // (probably only necessary on windows)
-        this->renderWindow_->setActive(true);
-
-        // render
-        ogreRoot_->_updateAllRenderTargets();
-
-        // again, just to be sure OGRE works fine
-        ogreRoot_->_fireFrameEnded(evt); // note: uses the same time as _fireFrameStarted
-    }
-
-    void GraphicsManager::setCamera(Ogre::Camera* camera)
-    {
-        this->viewport_->setCamera(camera);
-    }
-
-    /**
-    @brief
-        Creates the Ogre Root object and sets up the ogre log.
-    */
-    void GraphicsManager::setupOgre()
-    {
-        COUT(3) << "Setting up Ogre..." << std::endl;
-
-        if (ogreConfigFile_ == "")
-        {
-            COUT(2) << "Warning: Ogre config file set to \"\". Defaulting to config.cfg" << std::endl;
-            ModifyConfigValue(ogreConfigFile_, tset, "config.cfg");
-        }
-        if (ogreLogFile_ == "")
-        {
-            COUT(2) << "Warning: Ogre log file set to \"\". Defaulting to ogre.log" << std::endl;
-            ModifyConfigValue(ogreLogFile_, tset, "ogre.log");
-        }
-
-        boost::filesystem::path ogreConfigFilepath(Core::getConfigPath() / this->ogreConfigFile_);
-        boost::filesystem::path ogreLogFilepath(Core::getLogPath() / this->ogreLogFile_);
-
-        // create a new logManager
-        // Ogre::Root will detect that we've already created a Log
-        std::auto_ptr<Ogre::LogManager> logger(new Ogre::LogManager());
-        COUT(4) << "Ogre LogManager created" << std::endl;
-
-        // create our own log that we can listen to
-        Ogre::Log *myLog;
-        myLog = logger->createLog(ogreLogFilepath.string(), true, false, false);
-        COUT(4) << "Ogre Log created" << std::endl;
-
-        myLog->setLogDetail(Ogre::LL_BOREME);
-        myLog->addListener(this);
-
-        COUT(4) << "Creating Ogre Root..." << std::endl;
-
-        // check for config file existence because Ogre displays (caught) exceptions if not
-        if (!boost::filesystem::exists(ogreConfigFilepath))
-        {
-            // create a zero sized file
-            std::ofstream creator;
-            creator.open(ogreConfigFilepath.string().c_str());
-            creator.close();
-        }
-
-        // Leave plugins file empty. We're going to do that part manually later
-        ogreRoot_ = new Ogre::Root("", ogreConfigFilepath.string(), ogreLogFilepath.string());
-        // In case that new Root failed the logger gets destroyed because of the std::auto_ptr
-        ogreLogger_ = logger.release();
-
-        COUT(3) << "Ogre set up done." << std::endl;
-    }
-
-    void GraphicsManager::loadOgrePlugins()
-    {
-        // just to make sure the next statement doesn't segfault
-        if (ogrePluginsFolder_ == "")
-            ogrePluginsFolder_ = ".";
-
-        boost::filesystem::path folder(ogrePluginsFolder_);
-        // Do some SubString magic to get the comma separated list of plugins
-        SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '(', ')', false, '\0');
-        // Use backslash paths on Windows! file_string() already does that though.
-        for (unsigned int i = 0; i < plugins.size(); ++i)
-            ogreRoot_->loadPlugin((folder / plugins[i]).file_string());
-    }
-
-    void GraphicsManager::declareResources()
-    {
-        CCOUT(4) << "Declaring Resources" << std::endl;
-        //TODO: Specify layout of data file and maybe use xml-loader
-        //TODO: Work with ressource groups (should be generated by a special loader)
-
-        if (resourceFile_ == "")
-        {
-            COUT(2) << "Warning: Ogre resource file set to \"\". Defaulting to resources.cfg" << std::endl;
-            ModifyConfigValue(resourceFile_, tset, "resources.cfg");
-        }
-
-        // Load resource paths from data file using configfile ressource type
-        Ogre::ConfigFile cf;
-        try
-        {
-            cf.load((Core::getMediaPath() / resourceFile_).string());
-        }
-        catch (...)
-        {
-            //COUT(1) << ex.getFullDescription() << std::endl;
-            COUT(0) << "Have you forgotten to set the data path in orxnox.ini?" << std::endl;
-            throw;
-        }
-
-        // Go through all sections & settings in the file
-        Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
-
-        std::string secName, typeName, archName;
-        while (seci.hasMoreElements())
-        {
-            try
-            {
-                secName = seci.peekNextKey();
-                Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
-                Ogre::ConfigFile::SettingsMultiMap::iterator i;
-                for (i = settings->begin(); i != settings->end(); ++i)
-                {
-                    typeName = i->first; // for instance "FileSystem" or "Zip"
-                    archName = i->second; // name (and location) of archive
-
-                    Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
-                        (Core::getMediaPath() / archName).string(), typeName, secName);
-                }
-            }
-            catch (Ogre::Exception& ex)
-            {
-                COUT(1) << ex.getFullDescription() << std::endl;
-            }
-        }
-    }
-
-    void GraphicsManager::loadRenderer()
-    {
-        CCOUT(4) << "Configuring Renderer" << std::endl;
-
-        if (!ogreRoot_->restoreConfig())
-            if (!ogreRoot_->showConfigDialog())
-                ThrowException(InitialisationFailed, "OGRE graphics configuration dialogue failed.");
-
-        CCOUT(4) << "Creating render window" << std::endl;
-
-        this->renderWindow_ = ogreRoot_->initialise(true, "Orxonox");
-        this->ogreWindowEventListener_->windowResized(renderWindow_);
-
-        Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, ogreWindowEventListener_);
-
-        Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(0);
-
-        // create a full screen default viewport
-        this->viewport_ = this->renderWindow_->addViewport(0, 0);
-    }
-
-    void GraphicsManager::initialiseResources()
-    {
-        CCOUT(4) << "Initialising resources" << std::endl;
-        //TODO: Do NOT load all the groups, why are we doing that? And do we really do that? initialise != load...
-        //try
-        //{
-            Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
-            /*Ogre::StringVector str = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
-            for (unsigned int i = 0; i < str.size(); i++)
-            {
-            Ogre::ResourceGroupManager::getSingleton().loadResourceGroup(str[i]);
-            }*/
-        //}
-        //catch (...)
-        //{
-        //    CCOUT(2) << "Error: There was a serious error when initialising the resources." << std::endl;
-        //    throw;
-        //}
-    }
-
-    /**
-    @brief
-        Method called by the LogListener interface from Ogre.
-        We use it to capture Ogre log messages and handle it ourselves.
-    @param message
-        The message to be logged
-    @param lml
-        The message level the log is using
-    @param maskDebug
-        If we are printing to the console or not
-    @param logName
-        The name of this log (so you can have several listeners
-        for different logs, and identify them)
-    */
-    void GraphicsManager::messageLogged(const std::string& message,
-        Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName)
-    {
-        int orxonoxLevel;
-        switch (lml)
-        {
-        case Ogre::LML_TRIVIAL:
-            orxonoxLevel = this->ogreLogLevelTrivial_;
-            break;
-        case Ogre::LML_NORMAL:
-            orxonoxLevel = this->ogreLogLevelNormal_;
-            break;
-        case Ogre::LML_CRITICAL:
-            orxonoxLevel = this->ogreLogLevelCritical_;
-            break;
-        default:
-            orxonoxLevel = 0;
-        }
-        OutputHandler::getOutStream().setOutputLevel(orxonoxLevel)
-            << "Ogre: " << message << std::endl;
-    }
-
-    void GraphicsManager::printScreen()
-    {
-        assert(this->renderWindow_);
-       
-        this->renderWindow_->writeContentsToTimestampedFile(Core::getLogPathString() + "screenShot_", ".jpg");
-    }
-}

Deleted: branches/resource/src/orxonox/GraphicsManager.h
===================================================================
--- branches/resource/src/orxonox/GraphicsManager.h	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/orxonox/GraphicsManager.h	2009-07-24 19:37:19 UTC (rev 3346)
@@ -1,113 +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
- *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
- *   Co-authors:
- *      Felix Schulthess
- *
- */
-
-/**
- at file
- at brief
-    Declaration of GraphicsManager Singleton.
- */
-
-#ifndef _GraphicsManager_H__
-#define _GraphicsManager_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <cassert>
-#include <string>
-#include <OgreLog.h>
-#include "core/OrxonoxClass.h"
-
-namespace orxonox
-{
-    /**
-    @brief
-        Graphics engine manager class
-    */
-    class _OrxonoxExport GraphicsManager : public OrxonoxClass, public Ogre::LogListener
-    {
-    public:
-        GraphicsManager();
-        ~GraphicsManager();
-
-        void setConfigValues();
-
-        void update(const Clock& time);
-
-        inline Ogre::Viewport* getViewport()
-            { return this->viewport_; }
-        inline Ogre::RenderWindow* getRenderWindow()
-            { return this->renderWindow_; }
-
-        void setCamera(Ogre::Camera* camera);
-
-        inline static GraphicsManager& getInstance()
-            { assert(singletonRef_s); return *singletonRef_s; }
-
-    private:
-        GraphicsManager(GraphicsManager&); // don't mess with singletons
-
-        // OGRE initialisation
-        void setupOgre();
-        void loadOgrePlugins();
-        void declareResources();
-        void loadRenderer();
-        void initialiseResources();
-
-        // event from Ogre::LogListener
-        void messageLogged(const std::string& message, Ogre::LogMessageLevel lml,
-            bool maskDebug, const std::string& logName);
-
-        // console commands
-        void printScreen();
-
-    private:
-        Ogre::Root*         ogreRoot_;                 //!< Ogre's root
-        Ogre::LogManager*   ogreLogger_;
-        Ogre::RenderWindow* renderWindow_;             //!< the one and only render window
-        Ogre::Viewport*     viewport_;                 //!< default full size viewport
-        OgreWindowEventListener* ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h
-
-        // config values
-        std::string         resourceFile_;             //!< resources file name
-        std::string         ogreConfigFile_;           //!< ogre config file name
-        std::string         ogrePluginsFolder_;        //!< Folder where the Ogre plugins are located
-        std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
-        std::string         ogreLogFile_;              //!< log file name for Ogre log messages
-        int                 ogreLogLevelTrivial_;      //!< Corresponding Orxonx debug level for LL_TRIVIAL
-        int                 ogreLogLevelNormal_;       //!< Corresponding Orxonx debug level for LL_NORMAL
-        int                 ogreLogLevelCritical_;     //!< Corresponding Orxonx debug level for LL_CRITICAL
-
-        // console commands
-        ConsoleCommand*     ccPrintScreen_;
-
-        static GraphicsManager* singletonRef_s;        //!< Pointer to the Singleton
-    };
-}
-
-#endif /* _GraphicsManager_H__ */

Modified: branches/resource/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- branches/resource/src/orxonox/OrxonoxPrereqs.h	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/orxonox/OrxonoxPrereqs.h	2009-07-24 19:37:19 UTC (rev 3346)
@@ -73,10 +73,6 @@
         };
     }
 
-    class GraphicsManager;
-    class OgreWindowEventListener;
-    class Settings;
-
     class RadarViewable;
     class Radar;
     class RadarListener;
@@ -276,9 +272,6 @@
     class Scoreboard;
     class Map;
 
-    //gui
-    class GUIManager;
-
     //sound
     class SoundBase;
     class SoundManager;
@@ -292,17 +285,6 @@
     class DynamicRenderable;
 }
 
-namespace CEGUI
-{
-    class DefaultLogger;
-    class Logger;
-    class LuaScriptModule;
-
-    class OgreCEGUIRenderer;
-    class OgreCEGUIResourceProvider;
-    class OgreCEGUITexture;
-}
-
 // Bullet Physics Engine
 class btTransform;
 class btVector3;
@@ -329,7 +311,4 @@
 typedef unsigned int ALuint;
 typedef int ALint;
 
-// Lua
-struct lua_State;
-
 #endif /* _OrxonoxPrereqs_H__ */

Modified: branches/resource/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- branches/resource/src/orxonox/gamestates/GSGraphics.cc	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/orxonox/gamestates/GSGraphics.cc	2009-07-24 19:37:19 UTC (rev 3346)
@@ -44,16 +44,19 @@
 #include "core/Core.h"
 #include "core/Game.h"
 #include "core/GameMode.h"
+#include "core/GraphicsManager.h"
+#include "core/GUIManager.h"
 #include "core/input/InputManager.h"
 #include "core/input/KeyBinder.h"
 #include "core/input/InputState.h"
 #include "core/Loader.h"
 #include "core/XMLFile.h"
 #include "overlays/console/InGameConsole.h"
-#include "gui/GUIManager.h"
 #include "sound/SoundManager.h"
-#include "GraphicsManager.h"
 
+// HACK:
+#include "overlays/map/Map.h"
+
 namespace orxonox
 {
     DeclareGameState(GSGraphics, "graphics", true, true);
@@ -168,6 +171,9 @@
         delete this->inputManager_;
         this->inputManager_ = 0;
 
+        // HACK:
+        Map::hackDestroyMap();
+
         delete graphicsManager_;
 
         // Unload OGRE, CEGUI and OIS

Modified: branches/resource/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- branches/resource/src/orxonox/gamestates/GSLevel.cc	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/orxonox/gamestates/GSLevel.cc	2009-07-24 19:37:19 UTC (rev 3346)
@@ -39,6 +39,8 @@
 #include "core/Game.h"
 #include "core/GameMode.h"
 #include "core/Core.h"
+#include "core/GraphicsManager.h"
+#include "core/GUIManager.h"
 #include "core/Loader.h"
 #include "core/XMLFile.h"
 
@@ -46,9 +48,7 @@
 #include "objects/Radar.h"
 #include "objects/quest/QuestManager.h"
 #include "overlays/notifications/NotificationManager.h"
-#include "gui/GUIManager.h"
 #include "CameraManager.h"
-#include "GraphicsManager.h"
 #include "LevelManager.h"
 #include "PlayerManager.h"
 

Modified: branches/resource/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- branches/resource/src/orxonox/gamestates/GSMainMenu.cc	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/orxonox/gamestates/GSMainMenu.cc	2009-07-24 19:37:19 UTC (rev 3346)
@@ -35,10 +35,10 @@
 #include "core/Game.h"
 #include "core/Clock.h"
 #include "core/ConsoleCommand.h"
+#include "core/GraphicsManager.h"
+#include "core/GUIManager.h"
 #include "objects/Scene.h"
-#include "gui/GUIManager.h"
 #include "sound/SoundMainMenu.h"
-#include "GraphicsManager.h"
 
 namespace orxonox
 {

Modified: branches/resource/src/orxonox/objects/pickup/PickupInventory.cc
===================================================================
--- branches/resource/src/orxonox/objects/pickup/PickupInventory.cc	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/orxonox/objects/pickup/PickupInventory.cc	2009-07-24 19:37:19 UTC (rev 3346)
@@ -36,8 +36,8 @@
 #include <elements/CEGUITabControl.h>
 
 #include "core/ConsoleCommand.h"
+#include "core/GUIManager.h"
 #include "core/input/InputManager.h"
-#include "gui/GUIManager.h"
 #include "objects/controllers/HumanController.h"
 #include "objects/worldentities/pawns/Pawn.h"
 

Modified: branches/resource/src/orxonox/objects/pickup/PickupSpawner.cc
===================================================================
--- branches/resource/src/orxonox/objects/pickup/PickupSpawner.cc	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/orxonox/objects/pickup/PickupSpawner.cc	2009-07-24 19:37:19 UTC (rev 3346)
@@ -36,9 +36,9 @@
 #include "BaseItem.h"
 
 #include "core/CoreIncludes.h"
+#include "core/GUIManager.h"     // HACK; see below
 #include "core/Template.h"
 #include "core/XMLPort.h"
-#include "gui/GUIManager.h"     // HACK; see below
 #include "objects/worldentities/pawns/Pawn.h"
 #include "PickupInventory.h"    // HACK; Only for hack, remove later
 

Modified: branches/resource/src/orxonox/overlays/GUIOverlay.cc
===================================================================
--- branches/resource/src/orxonox/overlays/GUIOverlay.cc	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/orxonox/overlays/GUIOverlay.cc	2009-07-24 19:37:19 UTC (rev 3346)
@@ -33,8 +33,8 @@
 
 #include "core/input/InputManager.h"
 #include "core/CoreIncludes.h"
+#include "core/GUIManager.h"
 #include "core/XMLPort.h"
-#include "gui/GUIManager.h"
 
 namespace orxonox
 {

Modified: branches/resource/src/orxonox/tools/ParticleInterface.cc
===================================================================
--- branches/resource/src/orxonox/tools/ParticleInterface.cc	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/orxonox/tools/ParticleInterface.cc	2009-07-24 19:37:19 UTC (rev 3346)
@@ -44,7 +44,6 @@
 #include "core/CoreIncludes.h"
 #include "core/ConfigValueIncludes.h"
 #include "core/GameMode.h"
-#include "GraphicsManager.h"
 
 namespace orxonox
 {

Modified: branches/resource/src/orxonox/tools/Shader.cc
===================================================================
--- branches/resource/src/orxonox/tools/Shader.cc	2009-07-24 19:31:31 UTC (rev 3345)
+++ branches/resource/src/orxonox/tools/Shader.cc	2009-07-24 19:37:19 UTC (rev 3346)
@@ -40,7 +40,7 @@
 
 #include "core/CoreIncludes.h"
 #include "core/GameMode.h"
-#include "GraphicsManager.h"
+#include "core/GraphicsManager.h"
 
 namespace orxonox
 {




More information about the Orxonox-commit mailing list