Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 10, 2008, 1:37:36 AM (16 years ago)
Author:
rgrieder
Message:

merged gui back to trunk.
update the media repository!

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/Settings.h

    r1747 r1755  
    2929/**
    3030    @file Core.h
    31     @brief Definition of the Settings class.
     31    @brief Declaration of the Settings class.
    3232
    3333    The static Settings class is only used to configure some variables
     
    4141#include <string>
    4242#include "core/OrxonoxClass.h"
     43#include "util/Debug.h"
     44#include "util/MultiType.h"
     45#include "util/Convert.h"
    4346
    4447namespace orxonox
    4548{
    46   class _OrxonoxExport Settings : public OrxonoxClass
    47   {
     49    class _OrxonoxExport Settings : public OrxonoxClass
     50    {
     51        friend class ClassIdentifier<Settings>;
     52        friend class GSRoot;
     53        friend class GSGraphics;
     54        friend class GSServer;
     55        friend class GSDedicated;
     56
    4857    public:
    49       void setConfigValues();
    50       void dataPathChanged();
     58        static const std::string& getDataPath()
     59        { assert(singletonRef_s); return singletonRef_s->dataPath_; }
     60        static void tsetDataPath(const std::string& path)
     61        { assert(singletonRef_s); singletonRef_s->_tsetDataPath(path); }
    5162
    52       static const std::string& getDataPath();
    53 
    54       static void tsetDataPath(const std::string& path);
     63        // an alternative to a global game mode variable
     64        static bool showsGraphics() { assert(singletonRef_s); return singletonRef_s->bShowsGraphics_; }
     65        static bool hasServer()     { assert(singletonRef_s); return singletonRef_s->bHasServer_; }
    5566
    5667    private:
    57       Settings();
    58       Settings(const Settings& instance);
    59       ~Settings();
    60       static Settings& getSingleton();
     68        // GSRoot has access to these
     69        static void setShowsGraphics(bool val) { assert(singletonRef_s); singletonRef_s->bShowsGraphics_ = val; }
     70        static void setHasServer    (bool val) { assert(singletonRef_s); singletonRef_s->bHasServer_     = val; }
    6171
    62       void _tsetDataPath(const std::string& path);
     72        Settings();
     73        Settings(const Settings& instance);
     74        ~Settings() { singletonRef_s = 0; }
    6375
    64       std::string dataPath_;               //!< Path to the game data
    65   };
     76        static Settings& _getInstance() { assert(singletonRef_s); return *singletonRef_s; }
     77        void _tsetDataPath(const std::string& path);
     78        void dataPathChanged();
     79
     80        void setConfigValues();
     81
     82        bool bShowsGraphics_;                                  //!< global variable that tells whether to show graphics
     83        bool bHasServer_;                                      //!< global variable that tells whether this is a server
     84
     85        std::string dataPath_;                                 //!< Path to the game data
     86
     87        static Settings* singletonRef_s;                       //!< Static pointer to the only instance.
     88    };
     89
    6690}
    6791
Note: See TracChangeset for help on using the changeset viewer.