Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 30, 2009, 2:10:44 PM (15 years ago)
Author:
rgrieder
Message:

Merged resource branch back to the trunk. Changes:

  • Automated graphics loading by evaluating whether a GameState requires it
  • Using native Tcl library (x3n)

Windows users: Update your dependency package!

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/core/Core.h

    r3323 r3370  
    4343
    4444#include <cassert>
     45#include <boost/scoped_ptr.hpp>
    4546#include "util/OutputHandler.h"
     47#include "util/ScopeGuard.h"
     48#include "util/Singleton.h"
    4649
    4750namespace orxonox
    4851{
    4952    class CoreConfiguration;
     53    using boost::scoped_ptr;
    5054
    5155    /**
     
    5559        The class provides information about the media, config and log path.
    5660        It determines those by the use of platform specific functions.
     61    @remark
     62        You should only create this singleton once because it destroys the identifiers!
    5763    */
    58     class _CoreExport Core
     64    class _CoreExport Core : public Singleton<Core>
    5965    {
     66        typedef Loki::ScopeGuardImpl0<void (*)()> SimpleScopeGuard;
     67        friend class Singleton<Core>;
     68
    6069        public:
    6170            /**
     
    7180            void setConfigValues();
    7281
    73             void update(const Clock& time);
     82            bool preUpdate(const Clock& time) throw();
     83            bool postUpdate(const Clock& time) throw();
    7484
    75             static Core& getInstance() { assert(Core::singletonRef_s); return *Core::singletonRef_s; }
     85            void loadGraphics();
     86            void unloadGraphics();
    7687
    7788            static int   getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
     
    8798            //! Returns the path to the log files as boost::filesystem::path
    8899            static const boost::filesystem::path& getLogPath();
     100            //! Returns the path to the root folder as boost::filesystem::path
     101            static const boost::filesystem::path& getRootPath();
    89102            //! Returns the path to the data files as std::string
    90103            static std::string getMediaPathString();
     
    93106            //! Returns the path to the log files as std::string
    94107            static std::string getLogPathString();
     108            //! Returns the path to the root folder as std::string
     109            static std::string getRootPathString();
     110
     111            static bool isDevelopmentRun() { return getInstance().bDevRun_; }
    95112
    96113        private:
     
    102119            void setThreadAffinity(int limitToCPU);
    103120
    104             // Singletons
    105             ConfigFileManager*    configFileManager_;
    106             Language*             languageInstance_;
    107             LuaBind*              luaBind_;
    108             Shell*                shell_;
    109             SignalHandler*        signalHandler_;
    110             TclBind*              tclBind_;
    111             TclThreadManager*     tclThreadManager_;
     121            // Mind the order for the destruction!
     122            scoped_ptr<SignalHandler>     signalHandler_;
     123            SimpleScopeGuard              identifierDestroyer_;
     124            SimpleScopeGuard              consoleCommandDestroyer_;
     125            scoped_ptr<ConfigFileManager> configFileManager_;
     126            scoped_ptr<Language>          languageInstance_;
     127            scoped_ptr<CoreConfiguration> configuration_;
     128            scoped_ptr<LuaBind>           luaBind_;
     129            scoped_ptr<TclBind>           tclBind_;
     130            scoped_ptr<TclThreadManager>  tclThreadManager_;
     131            scoped_ptr<Shell>             shell_;
     132            // graphical
     133            scoped_ptr<GraphicsManager>   graphicsManager_;     //!< Interface to OGRE
     134            scoped_ptr<InputManager>      inputManager_;        //!< Interface to OIS
     135            scoped_ptr<GUIManager>        guiManager_;          //!< Interface to GUI
    112136
    113             bool isDevBuild_;                               //!< True for builds in the build directory (not installed)
    114             CoreConfiguration*    configuration_;
     137            bool                          bDevRun_;             //!< True for runs in the build directory (not installed)
     138            bool                          bGraphicsLoaded_;
    115139
    116             static Core* singletonRef_s;
     140            static Core* singletonPtr_s;
    117141    };
    118142}
Note: See TracChangeset for help on using the changeset viewer.