Changeset 1524 for code/branches/input/src/core/Core.cc
- Timestamp:
- Jun 3, 2008, 12:20:36 AM (16 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/input/src/core/Core.cc
r1510 r1524 28 28 29 29 /** 30 @file Core Settings.cc31 @brief Implementation of the Core Settingsclass.30 @file Core.cc 31 @brief Implementation of the Core class. 32 32 */ 33 33 34 #include "Core Settings.h"34 #include "Core.h" 35 35 #include "Language.h" 36 36 #include "CoreIncludes.h" 37 37 #include "ConfigValueIncludes.h" 38 #include "input/InputManager.h" 39 #include "TclThreadManager.h" 38 40 39 41 namespace orxonox … … 43 45 @param A reference to a global variable, used to avoid an infinite recursion in getSoftDebugLevel() 44 46 */ 45 Core Settings::CoreSettings()46 { 47 RegisterRootObject(Core Settings);47 Core::Core() 48 { 49 RegisterRootObject(Core); 48 50 this->setConfigValues(); 49 51 } … … 52 54 @brief Sets the bool to true to avoid static functions accessing a deleted object. 53 55 */ 54 Core Settings::~CoreSettings()56 Core::~Core() 55 57 { 56 58 isCreatingCoreSettings() = true; … … 58 60 59 61 /** 60 @brief Returns true if the Core Settingsinstance is not yet ready and the static functions have to return a default value.61 */ 62 bool& Core Settings::isCreatingCoreSettings()62 @brief Returns true if the Core instance is not yet ready and the static functions have to return a default value. 63 */ 64 bool& Core::isCreatingCoreSettings() 63 65 { 64 66 static bool bCreatingCoreSettings = true; … … 67 69 { 68 70 bFirstTime = false; 69 Core Settings::getInstance();71 Core::getInstance(); 70 72 } 71 73 return bCreatingCoreSettings; … … 73 75 74 76 /** 75 @brief Returns a unique instance of Core Settings.77 @brief Returns a unique instance of Core. 76 78 @return The instance 77 79 */ 78 Core Settings& CoreSettings::getInstance()79 { 80 static Core Settings instance = CoreSettings();80 Core& Core::getInstance() 81 { 82 static Core instance = Core(); 81 83 82 84 // If bCreatingSoftDebugLevelObject is true, we're just about to create an instance of the DebugLevel class 83 if (Core Settings::isCreatingCoreSettings())85 if (Core::isCreatingCoreSettings()) 84 86 { 85 87 isCreatingCoreSettings() = false; … … 92 94 @brief Function to collect the SetConfigValue-macro calls. 93 95 */ 94 void Core Settings::setConfigValues()96 void Core::setConfigValues() 95 97 { 96 98 SetConfigValue(softDebugLevelConsole_, 3).description("The maximal level of debug output shown in the console"); … … 121 123 @return The softDebugLevel 122 124 */ 123 int Core Settings::getSoftDebugLevel(OutputHandler::OutputDevice device)124 { 125 if (!Core Settings::isCreatingCoreSettings())125 int Core::getSoftDebugLevel(OutputHandler::OutputDevice device) 126 { 127 if (!Core::isCreatingCoreSettings()) 126 128 { 127 129 if (device == OutputHandler::LD_All) 128 return Core Settings::getInstance().softDebugLevel_;130 return Core::getInstance().softDebugLevel_; 129 131 else if (device == OutputHandler::LD_Console) 130 return Core Settings::getInstance().softDebugLevelConsole_;132 return Core::getInstance().softDebugLevelConsole_; 131 133 else if (device == OutputHandler::LD_Logfile) 132 return Core Settings::getInstance().softDebugLevelLogfile_;134 return Core::getInstance().softDebugLevelLogfile_; 133 135 else if (device == OutputHandler::LD_Shell) 134 return Core Settings::getInstance().softDebugLevelShell_;136 return Core::getInstance().softDebugLevelShell_; 135 137 } 136 138 … … 144 146 @param level The level 145 147 */ 146 void Core Settings::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)148 void Core::setSoftDebugLevel(OutputHandler::OutputDevice device, int level) 147 149 { 148 if (!Core Settings::isCreatingCoreSettings())150 if (!Core::isCreatingCoreSettings()) 149 151 { 150 152 if (device == OutputHandler::LD_All) 151 Core Settings::getInstance().softDebugLevel_ = level;153 Core::getInstance().softDebugLevel_ = level; 152 154 else if (device == OutputHandler::LD_Console) 153 Core Settings::getInstance().softDebugLevelConsole_ = level;155 Core::getInstance().softDebugLevelConsole_ = level; 154 156 else if (device == OutputHandler::LD_Logfile) 155 Core Settings::getInstance().softDebugLevelLogfile_ = level;157 Core::getInstance().softDebugLevelLogfile_ = level; 156 158 else if (device == OutputHandler::LD_Shell) 157 Core Settings::getInstance().softDebugLevelShell_ = level;159 Core::getInstance().softDebugLevelShell_ = level; 158 160 } 159 161 } … … 162 164 @brief Returns the configured language. 163 165 */ 164 const std::string& Core Settings::getLanguage()165 { 166 if (!Core Settings::isCreatingCoreSettings())167 return Core Settings::getInstance().language_;166 const std::string& Core::getLanguage() 167 { 168 if (!Core::isCreatingCoreSettings()) 169 return Core::getInstance().language_; 168 170 169 171 return Language::getLanguage().defaultLanguage_; … … 173 175 @brief Sets the language in the config-file back to the default. 174 176 */ 175 void Core Settings::resetLanguage()176 { 177 Core Settings::getInstance().resetLanguageIntern();177 void Core::resetLanguage() 178 { 179 Core::getInstance().resetLanguageIntern(); 178 180 } 179 181 … … 181 183 @brief Sets the language in the config-file back to the default. 182 184 */ 183 void Core Settings::resetLanguageIntern()185 void Core::resetLanguageIntern() 184 186 { 185 187 ResetConfigValue(language_); 188 } 189 190 /** 191 @brief Ticks every core class in a specified sequence. Has to be called 192 every Orxonox tick! 193 @param dt Delta Time 194 */ 195 void Core::tick(float dt) 196 { 197 TclThreadManager::getInstance().tick(dt); 198 InputManager::tick(dt); 186 199 } 187 200 } … … 193 206 int getSoftDebugLevel() 194 207 { 195 return orxonox::Core Settings::getSoftDebugLevel();208 return orxonox::Core::getSoftDebugLevel(); 196 209 }
Note: See TracChangeset
for help on using the changeset viewer.