Changeset 1524
- Timestamp:
- Jun 3, 2008, 12:20:36 AM (16 years ago)
- Location:
- code/branches/input
- Files:
-
- 2 added
- 22 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/input/src/audio/AudioManager.h
r1505 r1524 35 35 #include <string> 36 36 37 #include "core/Tickable.h"38 39 37 namespace audio 40 38 { 41 class _AudioExport AudioManager : public orxonox::Tickable39 class _AudioExport AudioManager 42 40 { 43 41 public: -
code/branches/input/src/core/CMakeLists.txt
r1520 r1524 4 4 ConfigFileManager.cc 5 5 ConfigValueContainer.cc 6 Core Settings.cc6 Core.cc 7 7 Error.cc 8 8 Executor.cc … … 27 27 SignalHandler.cc 28 28 TclBind.cc 29 Tickable.cc30 29 XMLPort.cc 31 30 TclThreadManager.cc -
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 } -
code/branches/input/src/core/Core.h
r1510 r1524 28 28 29 29 /** 30 @file Core Settings.h31 @brief Definition of the Core Settingsclass.30 @file Core.h 31 @brief Definition of the Core class. 32 32 33 The Core Settingsclass is a singleton, only used to configure some variables33 The Core class is a singleton, only used to configure some variables 34 34 in the core through the config-file. 35 35 */ … … 45 45 namespace orxonox 46 46 { 47 //! The Core Settingsclass is a singleton, only used to configure some config-values.48 class _CoreExport Core Settings: public OrxonoxClass47 //! The Core class is a singleton, only used to configure some config-values. 48 class _CoreExport Core : public OrxonoxClass 49 49 { 50 50 public: 51 static Core Settings& getInstance();51 static Core& getInstance(); 52 52 static bool& isCreatingCoreSettings(); 53 53 void setConfigValues(); … … 58 58 static void resetLanguage(); 59 59 60 static void tick(float dt); 61 60 62 private: 61 63 void resetLanguageIntern(); 62 64 63 Core Settings();64 Core Settings(const CoreSettings& other);65 virtual ~Core Settings();65 Core(); 66 Core(const Core& other); 67 virtual ~Core(); 66 68 67 69 int softDebugLevel_; //!< The debug level -
code/branches/input/src/core/CorePrereqs.h
r1520 r1524 112 112 class ConfigValueContainer; 113 113 class ConsoleCommand; 114 class Core Settings;114 class Core; 115 115 class Error; 116 116 class Executor; -
code/branches/input/src/core/Language.cc
r1505 r1524 36 36 #include <fstream> 37 37 38 #include "Core Settings.h"38 #include "Core.h" 39 39 40 40 #include "Debug.h" … … 245 245 void Language::readTranslatedLanguageFile() 246 246 { 247 COUT(4) << "Read translated language file (" << Core Settings::getLanguage() << ")." << std::endl;247 COUT(4) << "Read translated language file (" << Core::getLanguage() << ")." << std::endl; 248 248 249 249 // Open the file 250 250 std::ifstream file; 251 file.open(getFileName(Core Settings::getLanguage()).c_str(), std::fstream::in);251 file.open(getFileName(Core::getLanguage()).c_str(), std::fstream::in); 252 252 253 253 if (!file.is_open()) 254 254 { 255 255 COUT(1) << "An error occurred in Language.cc:" << std::endl; 256 COUT(1) << "Error: Couldn't open file " << getFileName(Core Settings::getLanguage()) << " to read the translated language entries!" << std::endl;257 Core Settings::resetLanguage();256 COUT(1) << "Error: Couldn't open file " << getFileName(Core::getLanguage()) << " to read the translated language entries!" << std::endl; 257 Core::resetLanguage(); 258 258 COUT(3) << "Info: Reset language to " << this->defaultLanguage_ << "." << std::endl; 259 259 return; … … 286 286 else 287 287 { 288 COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFileName(Core Settings::getLanguage()) << std::endl;288 COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFileName(Core::getLanguage()) << std::endl; 289 289 } 290 290 } -
code/branches/input/src/core/Language.h
r1505 r1524 113 113 class _CoreExport Language 114 114 { 115 friend class Core Settings;115 friend class Core; 116 116 117 117 public: -
code/branches/input/src/core/OutputHandler.cc
r1505 r1524 33 33 34 34 #include "OutputHandler.h" 35 #include "Core Settings.h"35 #include "Core.h" 36 36 #include "ConsoleCommand.h" 37 37 #include "Shell.h" … … 83 83 int OutputHandler::getSoftDebugLevel(OutputHandler::OutputDevice device) 84 84 { 85 return Core Settings::getSoftDebugLevel(device);85 return Core::getSoftDebugLevel(device); 86 86 } 87 87 -
code/branches/input/src/core/Shell.cc
r1519 r1524 31 31 #include "CoreIncludes.h" 32 32 #include "ConfigValueIncludes.h" 33 #include "Core Settings.h"33 #include "Core.h" 34 34 #include "ConsoleCommand.h" 35 35 #include "input/InputInterfaces.h" … … 67 67 Shell& Shell::createShell() 68 68 { 69 int level = Core Settings::getSoftDebugLevel(OutputHandler::LD_Shell);70 Core Settings::setSoftDebugLevel(OutputHandler::LD_Shell, -1);69 int level = Core::getSoftDebugLevel(OutputHandler::LD_Shell); 70 Core::setSoftDebugLevel(OutputHandler::LD_Shell, -1); 71 71 static Shell instance; 72 Core Settings::setSoftDebugLevel(OutputHandler::LD_Shell, level);72 Core::setSoftDebugLevel(OutputHandler::LD_Shell, level); 73 73 return instance; 74 74 } -
code/branches/input/src/core/TclThreadManager.h
r1505 r1524 30 30 #define _TclThreadManager_H__ 31 31 32 #include "CorePrereqs.h" 33 32 34 #include <queue> 33 35 #include <map> … … 38 40 #include <boost/thread/thread.hpp> 39 41 40 #include "CorePrereqs.h"41 #include "Tickable.h"42 42 #include "cpptcl/CppTcl.h" 43 #include "core/OrxonoxClass.h" 43 44 44 45 namespace orxonox … … 68 69 }; 69 70 70 class _CoreExport TclThreadManager : public Tickable71 class _CoreExport TclThreadManager : public OrxonoxClass 71 72 { 72 73 public: -
code/branches/input/src/core/input/InputManager.cc
r1520 r1524 499 499 @param dt Delta time 500 500 */ 501 void InputManager:: tick(float dt)501 void InputManager::_tick(float dt) 502 502 { 503 503 if (state_ == IS_UNINIT) … … 649 649 activeHandlers_[iHandler].first->tickInput(dt, activeHandlers_[iHandler].second); 650 650 } 651 651 652 652 void InputManager::_completeCalibration() 653 653 { … … 1141 1141 } 1142 1142 1143 void InputManager::tick(float dt) 1144 { 1145 _getSingleton()._tick(dt); 1146 } 1147 1143 1148 // ###### KeyHandler ###### 1144 1149 -
code/branches/input/src/core/input/InputManager.h
r1519 r1524 43 43 #include "ois/OIS.h" 44 44 #include "util/Math.h" 45 #include "core/ Tickable.h"45 #include "core/OrxonoxClass.h" 46 46 #include "InputInterfaces.h" 47 47 … … 89 89 */ 90 90 class _CoreExport InputManager 91 : public TickableReal,91 : public OrxonoxClass, 92 92 public OIS::KeyListener, public OIS::MouseListener, public OIS::JoyStickListener 93 93 { … … 143 143 static void calibrate(); 144 144 145 static void tick(float dt); 146 145 147 static bool addKeyHandler (KeyHandler* handler, const std::string& name); 146 148 static bool removeKeyHandler (const std::string& name); … … 191 193 unsigned int _getJoystick(const OIS::JoyStickEvent& arg); 192 194 193 void tick(float dt);195 void _tick(float dt); 194 196 195 197 // input events -
code/branches/input/src/network/Client.h
r1505 r1524 46 46 #include <string> 47 47 48 #include "core/Tickable.h"49 48 #include "ClientConnection.h" 50 49 #include "PacketManager.h" … … 63 62 * 64 63 */ 65 class _NetworkExport Client : PacketDecoder , public orxonox::Tickable{64 class _NetworkExport Client : PacketDecoder{ 66 65 public: 67 66 -
code/branches/input/src/network/Server.h
r1505 r1524 46 46 #include <string> 47 47 48 #include "core/Tickable.h"49 48 #include "PacketManager.h" 50 49 … … 57 56 * It implements all functions necessary for a Server 58 57 */ 59 class _NetworkExport Server : public PacketDecoder , public orxonox::Tickable{58 class _NetworkExport Server : public PacketDecoder{ 60 59 public: 61 60 Server(); -
code/branches/input/src/orxonox/CMakeLists.txt
r1505 r1524 29 29 objects/SpaceShip.cc 30 30 objects/SpaceShipAI.cc 31 objects/Tickable.cc 31 32 objects/WorldEntity.cc 32 33 -
code/branches/input/src/orxonox/Orxonox.cc
r1519 r1524 57 57 #include "core/Debug.h" 58 58 #include "core/Loader.h" 59 #include "core/Tickable.h"60 59 #include "core/input/InputManager.h" 61 60 #include "core/TclBind.h" 61 #include "core/Core.h" 62 62 63 63 // audio … … 70 70 // objects and tools 71 71 #include "hud/HUD.h" 72 #include <Ogre.h>72 #include "objects/Tickable.h" 73 73 74 74 #include "GraphicsEngine.h" … … 76 76 // FIXME: is this really file scope? 77 77 // globals for the server or client 78 network::Client *client_g ;79 network::Server *server_g ;78 network::Client *client_g = 0; 79 network::Server *server_g = 0; 80 80 81 81 namespace orxonox … … 430 430 } 431 431 432 // tick the core 433 Core::tick((float)evt.timeSinceLastFrame); 432 434 // Call those objects that need the real time 433 435 for (Iterator<TickableReal> it = ObjectList<TickableReal>::start(); it; ++it) … … 436 438 for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) 437 439 it->tick((float)evt.timeSinceLastFrame * this->timefactor_); 440 //AudioManager::tick(); 441 if (client_g) 442 client_g->tick((float)evt.timeSinceLastFrame); 443 if (server_g) 444 server_g->tick((float)evt.timeSinceLastFrame); 438 445 439 446 // don't forget to call _fireFrameStarted in ogre to make sure -
code/branches/input/src/orxonox/OrxonoxStableHeaders.h
r1505 r1524 104 104 #include "core/Debug.h" 105 105 //#include "core/Executor.h" 106 #include "core/Tickable.h"107 106 //#include "core/XMLPort.h" 108 107 … … 111 110 #include "OrxonoxPrereqs.h" 112 111 #include "tools/Timer.h" 112 #include "objects/Tickable.h" 113 113 #include "objects/Model.h" 114 114 #include "objects/WorldEntity.h" -
code/branches/input/src/orxonox/console/InGameConsole.h
r1505 r1524 36 36 #include <OgreTextAreaOverlayElement.h> 37 37 38 #include "core/Tickable.h"39 38 #include "core/Shell.h" 39 #include "objects/Tickable.h" 40 40 41 41 -
code/branches/input/src/orxonox/hud/HUD.h
r1505 r1524 36 36 #include <OgreTextAreaOverlayElement.h> 37 37 #include <OgreSceneNode.h> 38 #include " core/Tickable.h"38 #include "objects/Tickable.h" 39 39 #include "util/Math.h" 40 40 41 41 namespace orxonox 42 42 { 43 class _OrxonoxExport HUD : public Tickable 43 class _OrxonoxExport HUD : public TickableReal 44 44 { 45 45 private: -
code/branches/input/src/orxonox/hud/RadarOverlayElement.cc
r1505 r1524 35 35 36 36 #include "GraphicsEngine.h" 37 #include "core/Tickable.h"38 37 #include "core/ConsoleCommand.h" 38 #include "objects/Tickable.h" 39 39 #include "objects/SpaceShip.h" 40 40 #include "RadarObject.h" -
code/branches/input/src/orxonox/objects/Tickable.cc
r1510 r1524 27 27 */ 28 28 29 #include "OrxonoxStableHeaders.h" 29 30 #include "Tickable.h" 30 #include " CoreIncludes.h"31 #include " ConsoleCommand.h"31 #include "core/CoreIncludes.h" 32 #include "core/ConsoleCommand.h" 32 33 33 34 namespace orxonox -
code/branches/input/src/orxonox/objects/Tickable.h
r1510 r1524 42 42 #define _Tickable_H__ 43 43 44 #include " CorePrereqs.h"44 #include "OrxonoxPrereqs.h" 45 45 46 #include " OrxonoxClass.h"46 #include "core/OrxonoxClass.h" 47 47 48 48 namespace orxonox 49 49 { 50 50 //! The Tickable interface provides a tick(dt) function, that gets called every frame. 51 class _ CoreExport Tickable : virtual public OrxonoxClass51 class _OrxonoxExport Tickable : virtual public OrxonoxClass 52 52 { 53 53 public: … … 63 63 64 64 //! The Tickable interface provides a tick(dt) function, that gets called every frame. 65 class _ CoreExport TickableReal : virtual public OrxonoxClass65 class _OrxonoxExport TickableReal : virtual public OrxonoxClass 66 66 { 67 67 public: -
code/branches/input/src/orxonox/objects/WorldEntity.h
r1505 r1524 39 39 #include "network/Synchronisable.h" 40 40 #include "core/BaseObject.h" 41 #include " core/Tickable.h"41 #include "Tickable.h" 42 42 #include "../tools/Mesh.h" 43 43 -
code/branches/input/src/orxonox/tools/Timer.h
r1505 r1524 62 62 63 63 #include "OrxonoxPrereqs.h" 64 #include "core/CorePrereqs.h" 65 #include "core/Tickable.h" 64 #include "objects/Tickable.h" 66 65 67 66 namespace orxonox -
code/branches/input/visual_studio/vc8/core.vcproj
r1520 r1524 157 157 </File> 158 158 <File 159 RelativePath="..\..\src\core\Core Settings.cc"159 RelativePath="..\..\src\core\Core.cc" 160 160 > 161 161 </File> … … 186 186 <File 187 187 RelativePath="..\..\src\core\SignalHandler.cc" 188 >189 </File>190 <File191 RelativePath="..\..\src\core\Tickable.cc"192 188 > 193 189 </File> … … 351 347 </File> 352 348 <File 349 RelativePath="..\..\src\core\Core.h" 350 > 351 </File> 352 <File 353 353 RelativePath="..\..\src\core\CorePrereqs.h" 354 354 > 355 355 </File> 356 356 <File 357 RelativePath="..\..\src\core\CoreSettings.h"358 >359 </File>360 <File361 357 RelativePath="..\..\src\core\Debug.h" 362 358 > … … 392 388 <File 393 389 RelativePath="..\..\src\core\SignalHandler.h" 394 >395 </File>396 <File397 RelativePath="..\..\src\core\Tickable.h"398 390 > 399 391 </File> -
code/branches/input/visual_studio/vc8/orxonox.vcproj
r1502 r1524 256 256 </File> 257 257 <File 258 RelativePath="..\..\src\orxonox\objects\Tickable.cc" 259 > 260 </File> 261 <File 258 262 RelativePath="..\..\src\orxonox\objects\WorldEntity.cc" 259 263 > … … 539 543 <File 540 544 RelativePath="..\..\src\orxonox\objects\SpaceShipAI.h" 545 > 546 </File> 547 <File 548 RelativePath="..\..\src\orxonox\objects\Tickable.h" 541 549 > 542 550 </File>
Note: See TracChangeset
for help on using the changeset viewer.