Changeset 1755 for code/trunk/src/orxonox/Settings.h
- Timestamp:
- Sep 10, 2008, 1:37:36 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/gui (added) merged: 1636,1638,1640-1647,1649-1654,1656,1659-1665,1670,1672-1674,1686,1688-1692,1694-1697,1704 /code/branches/input (added) merged: 1629-1630
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/Settings.h
r1747 r1755 29 29 /** 30 30 @file Core.h 31 @brief De finition of the Settings class.31 @brief Declaration of the Settings class. 32 32 33 33 The static Settings class is only used to configure some variables … … 41 41 #include <string> 42 42 #include "core/OrxonoxClass.h" 43 #include "util/Debug.h" 44 #include "util/MultiType.h" 45 #include "util/Convert.h" 43 46 44 47 namespace orxonox 45 48 { 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 48 57 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); } 51 62 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_; } 55 66 56 67 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; } 61 71 62 void _tsetDataPath(const std::string& path); 72 Settings(); 73 Settings(const Settings& instance); 74 ~Settings() { singletonRef_s = 0; } 63 75 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 66 90 } 67 91
Note: See TracChangeset
for help on using the changeset viewer.