Changeset 1535
- Timestamp:
- Jun 4, 2008, 8:54:43 PM (17 years ago)
- Location:
- code/trunk
- Files:
-
- 13 deleted
- 31 edited
- 24 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/CMakeLists.txt
r1505 r1535 67 67 # FIND_PACKAGE(CEGUI_OGRE) 68 68 FIND_PACKAGE(ENet) 69 FIND_PACKAGE(Boost REQUIRED thread )70 FIND_PACKAGE(Boost REQUIRED filesystem)69 FIND_PACKAGE(Boost REQUIRED thread filesystem) 70 #FIND_PACKAGE(Boost REQUIRED filesystem) 71 71 FIND_PACKAGE(OpenAL) 72 72 FIND_PACKAGE(ALUT) -
code/trunk/src/audio/AudioManager.h
r1505 r1535 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/trunk/src/core/CMakeLists.txt
r1505 r1535 4 4 ConfigFileManager.cc 5 5 ConfigValueContainer.cc 6 Core Settings.cc6 Core.cc 7 7 Error.cc 8 8 Executor.cc … … 10 10 Identifier.cc 11 11 IdentifierDistributor.cc 12 InputManager.cc13 KeyBinder.cc14 12 OutputBuffer.cc 15 InputBuffer.cc16 13 Shell.cc 17 14 CommandExecutor.cc … … 30 27 SignalHandler.cc 31 28 TclBind.cc 32 Tickable.cc33 29 XMLPort.cc 34 30 TclThreadManager.cc 35 31 IRC.cc 32 33 input/Button.cc 34 input/CalibratorCallback.cc 35 input/HalfAxis.cc 36 input/InputBuffer.cc 37 input/InputCommands.cc 38 input/InputManager.cc 39 input/KeyBinder.cc 40 input/KeyDetector.cc 41 36 42 tolua/tolua_bind.cc 37 43 ) -
code/trunk/src/core/CorePrereqs.h
r1505 r1535 112 112 class ConfigValueContainer; 113 113 class ConsoleCommand; 114 class Core Settings;114 class Core; 115 115 class Error; 116 116 class Executor; … … 162 162 // input 163 163 //class GUIInputHandler; 164 class Calibrator; 164 class BaseCommand; 165 class BufferedParamCommand; 166 class Button; 165 167 class CalibratorCallback; 168 class HalfAxis; 166 169 class InputBuffer; 167 class InputBufferListener;168 170 class InputManager; 169 171 class JoyStickHandler; 172 class MouseHandler; 170 173 class KeyBinder; 171 174 class KeyDetector; 172 class MouseHandler; 173 175 class KeyHandler; 176 class ParamCommand; 177 class SimpleCommand; 174 178 } 175 179 -
code/trunk/src/core/Language.cc
r1505 r1535 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/trunk/src/core/Language.h
r1505 r1535 113 113 class _CoreExport Language 114 114 { 115 friend class Core Settings;115 friend class Core; 116 116 117 117 public: -
code/trunk/src/core/OutputHandler.cc
r1505 r1535 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/trunk/src/core/Shell.cc
r1505 r1535 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 #include " InputInterfaces.h"35 #include "input/InputInterfaces.h" 36 36 37 37 #define SHELL_UPDATE_LISTENERS(function) \ … … 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/trunk/src/core/Shell.h
r1505 r1535 36 36 37 37 #include "OrxonoxClass.h" 38 #include " InputBuffer.h"38 #include "input/InputBuffer.h" 39 39 #include "OutputBuffer.h" 40 40 -
code/trunk/src/core/TclThreadManager.h
r1505 r1535 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/trunk/src/network/Client.h
r1534 r1535 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/trunk/src/network/Server.h
r1534 r1535 46 46 #include <string> 47 47 48 #include "core/Tickable.h"49 48 #include "PacketManager.h" 50 49 … … 59 58 * It implements all functions necessary for a Server 60 59 */ 61 class _NetworkExport Server : public PacketDecoder , public orxonox::Tickable{60 class _NetworkExport Server : public PacketDecoder{ 62 61 public: 63 62 static Server *createSingleton(); -
code/trunk/src/orxonox/CMakeLists.txt
r1505 r1535 3 3 Main.cc 4 4 Orxonox.cc 5 Settings.cc 5 6 6 7 console/InGameConsole.cc … … 29 30 objects/SpaceShip.cc 30 31 objects/SpaceShipAI.cc 32 objects/Tickable.cc 31 33 objects/WorldEntity.cc 32 34 -
code/trunk/src/orxonox/GraphicsEngine.cc
r1511 r1535 21 21 * 22 22 * Author: 23 * Benjamin Knecht <beni_at_orxonox.net>, (C) 200723 * Reto Grieder 24 24 * Co-authors: 25 * Reto Grieder25 * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007, Felix Schulthess 26 26 * 27 27 */ … … 35 35 #include "GraphicsEngine.h" 36 36 37 #include <OgreConfigFile.h> 38 #include <OgreException.h> 39 #include <OgreLogManager.h> 37 40 #include <OgreRoot.h> 38 #include <OgreException.h> 39 #include <OgreConfigFile.h> 40 #include <OgreLogManager.h> 41 #include <OgreSceneManager.h> 41 42 #include <OgreTextureManager.h> 42 #include "core/InputManager.h" 43 #include <OgreViewport.h> 44 43 45 #include "core/CoreIncludes.h" 44 46 #include "core/ConfigValueIncludes.h" 45 47 #include "core/Debug.h" 46 48 #include "core/CommandExecutor.h" 47 #include "core/TclBind.h" 49 #include "core/ConsoleCommand.h" 50 #include "core/input/InputManager.h" 51 48 52 #include "console/InGameConsole.h" 49 50 #include "core/ConsoleCommand.h" 51 #include <OgreSceneManager.h> 52 #include <OgreCompositorManager.h> 53 #include <OgreViewport.h> 53 #include "Settings.h" 54 54 55 55 56 namespace orxonox { … … 70 71 root_(0), 71 72 scene_(0), 72 renderWindow_(0), 73 //configPath_(""), 74 dataPath_(""), 75 ogreLogfile_("") 73 renderWindow_(0) 76 74 { 77 75 RegisterObject(GraphicsEngine); … … 83 81 void GraphicsEngine::setConfigValues() 84 82 { 85 SetConfigValue(dataPath_, "../../Media/").description("relative path to media data"); 86 SetConfigValue(ogreLogfile_, "ogre.log").description("Logfile for messages from Ogre. Use \"\" to suppress log file creation."); 83 SetConfigValue(resourceFile_, "resources.cfg").description("Location of the resources file in the data path."); 84 SetConfigValue(ogreConfigFile_, "ogre.cfg").description("Location of the Ogre config file"); 85 SetConfigValue(ogrePluginsFile_, "plugins.cfg").description("Location of the Ogre plugins file"); 86 SetConfigValue(ogreLogFile_, "ogre.log").description("Logfile for messages from Ogre. \ 87 Use \"\" to suppress log file creation."); 87 88 SetConfigValue(ogreLogLevelTrivial_ , 5).description("Corresponding orxonox debug level for ogre Trivial"); 88 89 SetConfigValue(ogreLogLevelNormal_ , 4).description("Corresponding orxonox debug level for ogre Normal"); 89 90 SetConfigValue(ogreLogLevelCritical_, 2).description("Corresponding orxonox debug level for ogre Critical"); 90 91 TclBind::getInstance().setDataPath(this->dataPath_);92 91 } 93 92 … … 126 125 @brief Creates the Ogre Root object and sets up the ogre log. 127 126 */ 128 bool GraphicsEngine::setup( std::string& dataPath)127 bool GraphicsEngine::setup() 129 128 { 130 129 CCOUT(3) << "Setting up..." << std::endl; 131 130 // temporary overwrite of dataPath, change ini file for permanent change 132 if (dataPath != "")133 dataPath_ = dataPath;134 if (dataPath_ == "")135 return false;136 if (dataPath_[dataPath_.size() - 1] != '/')137 dataPath_ += "/";138 139 //TODO: Check if file exists (maybe not here)140 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC && defined(_DEBUG)141 std::string plugin_filename = "plugins_d.cfg";142 #else143 std::string plugin_filename = "plugins.cfg";144 #endif145 131 146 132 // TODO: LogManager doesn't work on specific systems. The why is unknown yet. … … 154 140 // create our own log that we can listen to 155 141 Ogre::Log *myLog; 156 if (this->ogreLog file_ == "")142 if (this->ogreLogFile_ == "") 157 143 myLog = logger->createLog("ogre.log", true, false, true); 158 144 else 159 myLog = logger->createLog(this->ogreLog file_, true, false, false);145 myLog = logger->createLog(this->ogreLogFile_, true, false, false); 160 146 CCOUT(4) << "Ogre Log created" << std::endl; 161 147 … … 167 153 CCOUT(4) << "Creating Ogre Root..." << std::endl; 168 154 169 root_ = new Ogre::Root(plugin_filename, "ogre.cfg", this->ogreLogfile_); 155 if (ogrePluginsFile_ == "") 156 { 157 COUT(1) << "Error: Ogre plugins file set to \"\". Cannot load." << std::endl; 158 return false; 159 } 160 if (ogreConfigFile_ == "") 161 { 162 COUT(1) << "Error: Ogre config file set to \"\". Cannot load." << std::endl; 163 return false; 164 } 165 if (ogreLogFile_ == "") 166 { 167 COUT(1) << "Error: Ogre log file set to \"\". Cannot load." << std::endl; 168 return false; 169 } 170 171 try 172 { 173 root_ = new Ogre::Root(ogrePluginsFile_, ogreConfigFile_, ogreLogFile_); 174 } 175 catch (Ogre::Exception ex) 176 { 177 COUT(2) << "Error: There was an exception when creating Ogre Root." << std::endl; 178 return false; 179 } 180 181 if (!root_->getInstalledPlugins().size()) 182 { 183 COUT(1) << "Error: No plugins declared. Cannot load Ogre." << std::endl; 184 COUT(0) << "Is the plugins file correctly declared?" << std::endl; 185 return false; 186 } 170 187 171 188 #if 0 … … 180 197 181 198 // specify where Ogre has to look for resources. This call doesn't parse anything yet! 182 declareRessourceLocations(); 199 if (!declareRessourceLocations()) 200 return false; 183 201 184 202 CCOUT(3) << "Set up done." << std::endl; … … 186 204 } 187 205 188 voidGraphicsEngine::declareRessourceLocations()206 bool GraphicsEngine::declareRessourceLocations() 189 207 { 190 208 CCOUT(4) << "Declaring Resources" << std::endl; 191 209 //TODO: Specify layout of data file and maybe use xml-loader 192 210 //TODO: Work with ressource groups (should be generated by a special loader) 211 212 if (resourceFile_ == "") 213 { 214 COUT(1) << "Error: Resource file set to \"\". Cannot load." << std::endl; 215 return false; 216 } 217 193 218 // Load resource paths from data file using configfile ressource type 194 219 Ogre::ConfigFile cf; 195 cf.load(dataPath_ + "resources.cfg"); 220 try 221 { 222 cf.load(Settings::getDataPath() + resourceFile_); 223 } 224 catch (Ogre::Exception ex) 225 { 226 COUT(1) << "Error: Could not load resources.cfg in path " << Settings::getDataPath() << std::endl; 227 COUT(0) << "Have you forgotten to set the data path in orxnox.ini?" << std::endl; 228 return false; 229 } 196 230 197 231 // Go through all sections & settings in the file … … 201 235 while (seci.hasMoreElements()) 202 236 { 203 secName = seci.peekNextKey(); 204 Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext(); 205 Ogre::ConfigFile::SettingsMultiMap::iterator i; 206 for (i = settings->begin(); i != settings->end(); ++i) 237 try 207 238 { 208 typeName = i->first; // for instance "FileSystem" or "Zip" 209 archName = i->second; // name (and location) of archive 210 211 Ogre::ResourceGroupManager::getSingleton().addResourceLocation( 212 std::string(dataPath_ + archName), 213 typeName, secName); 239 secName = seci.peekNextKey(); 240 Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext(); 241 Ogre::ConfigFile::SettingsMultiMap::iterator i; 242 for (i = settings->begin(); i != settings->end(); ++i) 243 { 244 typeName = i->first; // for instance "FileSystem" or "Zip" 245 archName = i->second; // name (and location) of archive 246 247 Ogre::ResourceGroupManager::getSingleton().addResourceLocation( 248 std::string(Settings::getDataPath() + archName), typeName, secName); 249 } 214 250 } 215 } 251 catch (Ogre::Exception ex) 252 { 253 COUT(2) << "Exception while reading resources.cfg. Proceeding.." << ex.getDescription() << std::endl; 254 } 255 } 256 return true; 216 257 } 217 258 … … 223 264 224 265 CCOUT(4) << "Creating render window" << std::endl; 225 this->renderWindow_ = root_->initialise(true, "OrxonoxV2"); 266 try 267 { 268 this->renderWindow_ = root_->initialise(true, "OrxonoxV2"); 269 } 270 catch (Ogre::Exception ex) 271 { 272 COUT(2) << "Error: There was an exception when initialising Ogre Root." << std::endl; 273 return false; 274 } 275 226 276 if (!root_->isInitialised()) 227 277 { 228 CCOUT(2) << "Error: Creating Ogre root object failed" << std::endl;278 CCOUT(2) << "Error: Initialising Ogre root object failed." << std::endl; 229 279 return false; 230 280 } -
code/trunk/src/orxonox/GraphicsEngine.h
r1511 r1535 21 21 * 22 22 * Author: 23 * Benjamin Knecht <beni_at_orxonox.net>, (C) 200723 * Reto Grieder 24 24 * Co-authors: 25 * Reto Grieder25 * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007, Felix Schulthess 26 26 * 27 27 */ … … 56 56 public: 57 57 void setConfigValues(); 58 bool setup( std::string& dataPath);59 voiddeclareRessourceLocations();58 bool setup(); 59 bool declareRessourceLocations(); 60 60 bool loadRenderer(); 61 61 bool initialiseResources(); … … 65 65 66 66 Ogre::SceneManager* getSceneManager() { return scene_; } 67 std::string& getDataPath() { return dataPath_; }68 67 69 68 // several window properties … … 95 94 bool, const std::string&); 96 95 97 Ogre::Root* root_; //!< Ogre's root98 Ogre::SceneManager* scene_; //!< scene manager of the game99 Ogre::RenderWindow* renderWindow_; //!< the current render window100 //bool bOverwritePath_; //!< overwrites path101 //std::string configPath_; //!< path to config file102 std::string dataPath_; //!< path to data file103 std::string ogreLog file_;//!< log file name for Ogre log messages104 int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL105 int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL106 int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL96 Ogre::Root* root_; //!< Ogre's root 97 Ogre::SceneManager* scene_; //!< scene manager of the game 98 Ogre::RenderWindow* renderWindow_; //!< the current render window 99 std::string resourceFile_; //!< resources file name 100 std::string ogreConfigFile_; //!< ogre config file name 101 std::string ogrePluginsFile_; //!< ogre plugins file name 102 std::string ogreLogFile_; //!< log file name for Ogre log messages 103 int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL 104 int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL 105 int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL 107 106 }; 108 107 } -
code/trunk/src/orxonox/Main.cc
r1505 r1535 82 82 res = orx->init(argc, argv, macBundlePath()); 83 83 #else 84 res = orx->init(argc, argv , "");84 res = orx->init(argc, argv); 85 85 #endif 86 86 -
code/trunk/src/orxonox/Orxonox.cc
r1534 r1535 21 21 * 22 22 * Author: 23 * Reto Grieder 24 * Co-authors: 23 25 * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 24 * Co-authors:25 * ...26 26 * 27 27 */ … … 57 57 #include "core/Debug.h" 58 58 #include "core/Loader.h" 59 #include "core/Tickable.h" 60 #include "core/InputManager.h" 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" 75 #include "Settings.h" 75 76 76 77 // FIXME: is this really file scope? 77 78 // globals for the server or client 78 network::Client *client_g ;79 network::Server *server_g ;79 network::Client *client_g = 0; 80 network::Server *server_g = 0; 80 81 81 82 namespace orxonox … … 166 167 * @param path path to config (in home dir or something) 167 168 */ 168 bool Orxonox::init(int argc, char **argv, std::string path) 169 { 170 //TODO: find config file (assuming executable directory) 171 //TODO: read config file 172 //TODO: give config file to Ogre 169 bool Orxonox::init(int argc, char **argv) 170 { 171 #ifdef _DEBUG 172 ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox_d.ini"); 173 #else 174 ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini"); 175 #endif 176 Factory::createClassHierarchy(); 177 173 178 std::string mode; 174 std::string dataPath;179 std::string tempDataPath; 175 180 176 181 ArgReader ar(argc, argv); 177 ar.checkArgument("mode", mode, false);178 ar.checkArgument("data", dataPath, false);179 ar.checkArgument("ip", serverIp_, false);180 ar.checkArgument("port", serverPort_, false);182 ar.checkArgument("mode", &mode, false); 183 ar.checkArgument("data", &tempDataPath, false); 184 ar.checkArgument("ip", &serverIp_, false); 185 ar.checkArgument("port", &serverPort_, false); 181 186 if(ar.errorHandling()) 187 { 188 COUT(1) << "Error while parsing command line arguments" << std::endl; 189 COUT(1) << ar.getErrorString(); 190 COUT(0) << "Usage:" << std::endl << "orxonox [mode client|server|dedicated|standalone] " 191 << "[--data PATH] [--ip IP] [--port PORT]" << std::endl; 182 192 return false; 193 } 183 194 184 195 if (mode == "client") … … 190 201 else 191 202 { 192 mode = "standalone"; 203 if (mode == "") 204 mode = "standalone"; 205 if (mode != "standalone") 206 { 207 COUT(2) << "Warning: mode \"" << mode << "\" doesn't exist. " 208 << "Defaulting to standalone" << std::endl; 209 mode = "standalone"; 210 } 193 211 mode_ = STANDALONE; 194 212 } 195 213 COUT(3) << "Orxonox: Mode is " << mode << "." << std::endl; 214 215 if (tempDataPath != "") 216 { 217 if (tempDataPath[tempDataPath.size() - 1] != '/') 218 tempDataPath += "/"; 219 Settings::tsetDataPath(tempDataPath); 220 } 221 222 // initialise TCL 223 TclBind::getInstance().setDataPath(Settings::getDataPath()); 196 224 197 225 //if (mode_ == DEDICATED) … … 202 230 // procedure until the GUI is identical 203 231 204 ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");205 Factory::createClassHierarchy();206 207 232 ogre_ = &GraphicsEngine::getSingleton(); 208 if (!ogre_->setup( path)) // creates ogre root and other essentials233 if (!ogre_->setup()) // creates ogre root and other essentials 209 234 return false; 210 235 … … 421 446 } 422 447 448 // tick the core 449 Core::tick((float)evt.timeSinceLastFrame); 423 450 // Call those objects that need the real time 424 451 for (Iterator<TickableReal> it = ObjectList<TickableReal>::start(); it; ++it) … … 427 454 for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) 428 455 it->tick((float)evt.timeSinceLastFrame * this->timefactor_); 456 //AudioManager::tick(); 457 if (client_g) 458 client_g->tick((float)evt.timeSinceLastFrame); 459 if (server_g) 460 server_g->tick((float)evt.timeSinceLastFrame); 429 461 430 462 // don't forget to call _fireFrameStarted in ogre to make sure -
code/trunk/src/orxonox/Orxonox.h
r1505 r1535 21 21 * 22 22 * Author: 23 * ...23 * Reto Grieder 24 24 * Co-authors: 25 * ...25 * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 26 26 * 27 27 */ … … 58 58 { 59 59 public: 60 bool init(int argc, char **argv , std::string path);60 bool init(int argc, char **argv); 61 61 bool start(); 62 62 -
code/trunk/src/orxonox/OrxonoxStableHeaders.h
r1505 r1535 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/trunk/src/orxonox/console/InGameConsole.cc
r1505 r1535 42 42 #include "core/ConfigValueIncludes.h" 43 43 #include "core/ConsoleCommand.h" 44 #include "core/ InputManager.h"44 #include "core/input/InputManager.h" 45 45 #include "util/Math.h" 46 46 #include "GraphicsEngine.h" -
code/trunk/src/orxonox/console/InGameConsole.h
r1505 r1535 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/trunk/src/orxonox/hud/HUD.h
r1505 r1535 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/trunk/src/orxonox/hud/RadarOverlayElement.cc
r1505 r1535 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/trunk/src/orxonox/objects/SpaceShip.cc
r1534 r1535 42 42 #include "core/Debug.h" 43 43 #include "GraphicsEngine.h" 44 #include "core/ InputManager.h"44 #include "core/input/InputManager.h" 45 45 #include "particle/ParticleInterface.h" 46 46 #include "Projectile.h" -
code/trunk/src/orxonox/objects/SpaceShip.h
r1534 r1535 34 34 35 35 #include "util/Math.h" 36 #include "core/InputInterfaces.h"37 36 #include "Camera.h" 38 37 #include "Model.h" 39 #include " ../tools/BillboardSet.h"38 #include "tools/BillboardSet.h" 40 39 41 40 namespace orxonox -
code/trunk/src/orxonox/objects/WorldEntity.h
r1505 r1535 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/trunk/src/orxonox/tools/Timer.h
r1505 r1535 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/trunk/src/util/ArgReader.cc
r1505 r1535 21 21 * 22 22 * Author: 23 * Benjamin Knecht <beni_at_orxonox.net>, (C) 200723 * Reto Grieder 24 24 * Co-authors: 25 * ...25 * Benjamin Knecht <beni_at_orxonox.net> 26 26 * 27 27 */ … … 33 33 34 34 #include "ArgReader.h" 35 #include "SubString.h" 35 36 36 #include <iostream> 37 ArgReader::ArgReader(int argc, char **argv) 38 { 39 failure_ = false; 40 errorString_ = ""; 41 CmdLineArg arg; 37 42 38 ArgReader::ArgReader(int argc, char** argv) 39 { 40 counter_ = argc; 41 arguments_ = argv; 42 fail_ = false; 43 errorStr_ = ""; 44 } 43 int i = 1; 44 while (i < argc) 45 { 46 if (argv[i][0] == '-' && argv[i][1] == '-') // name 47 { 48 if (argv[i][2] == '\0') 49 { 50 failure_ = true; 51 errorString_ += "Expected word after \"--\".\n"; 52 } 53 arg.bChecked_ = false; 54 arg.name_ = argv[i] + 2; 55 arg.value_ = ""; 56 arguments_.push_back(arg); 57 } 58 else // value 59 { 60 if (arguments_.size() == 0) 61 { 62 failure_ = true; 63 errorString_ += "Expected \"--\" in command line arguments.\n"; 64 arg.bChecked_ = false; 65 arg.name_ = ""; 66 arg.value_ = ""; 67 arguments_.push_back(arg); 68 } 45 69 46 void ArgReader::checkArgument(std::string option, std::string &string, bool must)47 { 48 int argpos = checkOption(option) + 1;49 if(argpos != 0)50 {51 string = arguments_[argpos];70 if (arguments_.back().value_ != "") 71 arguments_.back().value_ += " " + std::string(argv[i]); 72 else 73 arguments_.back().value_ = argv[i]; 74 } 75 ++i; 52 76 } 53 else54 {55 if(must) {56 errorStr_ = errorStr_ + "Cannot find mandatory argument \"" + option + "\"\n";57 fail_ = true;58 }59 }60 61 }62 63 void ArgReader::checkArgument(std::string option, int &integer, bool must)64 {65 int argpos = checkOption(option) + 1;66 if(argpos != 0)67 {68 integer = atoi(arguments_[argpos]);69 }70 else71 {72 if(must) {73 errorStr_ = errorStr_ + "Cannot find mandatory argument \"" + option + "\"\n";74 fail_ = true;75 }76 }77 }78 79 void ArgReader::checkArgument(std::string option, float &floating, bool must)80 {81 int argpos = checkOption(option) + 1;82 if(argpos != 0)83 {84 floating = (float)atof(arguments_[argpos]);85 }86 else87 {88 if(must) {89 errorStr_ = errorStr_ + "Cannot find mandatory argument \"" + option + "\"\n";90 fail_ = true;91 }92 }93 }94 95 int ArgReader::checkOption(std::string option)96 {97 for(int i = 1; i < counter_; i++)98 {99 if(arguments_[i] == "--" + option)100 return i;101 }102 return -1;103 77 } 104 78 105 79 bool ArgReader::errorHandling() 106 80 { 107 if(fail_) 108 std::cout << errorStr_; 109 return fail_; 81 bool argumentsChecked = true; 82 for (unsigned int i = 1; i < arguments_.size(); ++i) 83 argumentsChecked &= arguments_[i].bChecked_; 84 85 if (!argumentsChecked) 86 errorString_ += "Not all arguments could be matched.\n"; 87 88 return !argumentsChecked || failure_; 110 89 } 90 91 const std::string& ArgReader::getErrorString() 92 { 93 return errorString_; 94 } -
code/trunk/src/util/ArgReader.h
r1505 r1535 21 21 * 22 22 * Author: 23 * Reto Grieder 24 * Co-authors: 23 25 * Benjamin Knecht <beni_at_orxonox.net> 24 * Co-authors:25 * ...26 26 * 27 27 */ … … 39 39 40 40 #include <string> 41 #include <vector> 42 #include "Convert.h" 43 44 struct _UtilExport CmdLineArg 45 { 46 std::string name_; 47 std::string value_; 48 bool bChecked_; 49 }; 41 50 42 51 class _UtilExport ArgReader … … 44 53 public: 45 54 ArgReader(int argc, char **argv); 46 void checkArgument(std::string option, std::string& string, bool must=false); 47 void checkArgument(std::string option, int& integer, bool must=false); 48 void checkArgument(std::string option, float& floating, bool must=false); 55 template <class T> 56 void checkArgument(std::string option, T* value, bool must = false); 49 57 bool errorHandling(); 50 private: 51 int checkOption(std::string option); 58 const std::string& getErrorString(); 52 59 53 60 private: 54 int counter_; 55 char **arguments_; 56 bool fail_; 57 std::string errorStr_; 61 std::vector<CmdLineArg> arguments_; 62 bool failure_; 63 std::string errorString_; 58 64 }; 59 65 66 template <class T> 67 void ArgReader::checkArgument(std::string option, T* value, bool must) 68 { 69 unsigned int iArg = 0; 70 while (iArg < arguments_.size()) 71 { 72 if (arguments_[iArg].name_ == option) 73 break; 74 ++iArg; 75 } 76 if (iArg == arguments_.size()) 77 { 78 if (must) 79 { 80 failure_ = true; 81 errorString_ += "Cannot find mandatory argument \"" + option + "\"\n"; 82 return; 83 } 84 else 85 return; 86 } 87 88 arguments_[iArg].bChecked_ = true; 89 90 if (!convertValue(value, arguments_[iArg].value_)) 91 { 92 failure_ = true; 93 errorString_ += "Cannot convert argument value for option \"" + option + "\"\n"; 94 } 95 } 96 97 template <> 98 void ArgReader::checkArgument(std::string option, bool* value, bool must) 99 { 100 // for type bool, only check whether the option was set or not 101 unsigned int iArg = 0; 102 while (iArg < arguments_.size()) 103 { 104 if (arguments_[iArg].name_ == option) 105 { 106 arguments_[iArg].bChecked_ = true; 107 *value = true; 108 break; 109 } 110 ++iArg; 111 } 112 if (iArg == arguments_.size()) 113 *value = false; 114 } 115 60 116 #endif /* _ArgReader_H__ */ -
code/trunk/visual_studio/vc8/core.vcproj
r1502 r1535 157 157 </File> 158 158 <File 159 RelativePath="..\..\src\core\Core Settings.cc"159 RelativePath="..\..\src\core\Core.cc" 160 160 > 161 161 </File> … … 188 188 > 189 189 </File> 190 <File191 RelativePath="..\..\src\core\Tickable.cc"192 >193 </File>194 190 <Filter 195 191 Name="tolua" … … 280 276 > 281 277 <File 282 RelativePath="..\..\src\core\InputBuffer.cc" 283 > 284 </File> 285 <File 286 RelativePath="..\..\src\core\InputManager.cc" 287 > 288 </File> 289 <File 290 RelativePath="..\..\src\core\KeyBinder.cc" 278 RelativePath="..\..\src\core\input\Button.cc" 279 > 280 </File> 281 <File 282 RelativePath="..\..\src\core\input\CalibratorCallback.cc" 283 > 284 </File> 285 <File 286 RelativePath="..\..\src\core\input\HalfAxis.cc" 287 > 288 </File> 289 <File 290 RelativePath="..\..\src\core\input\InputBuffer.cc" 291 > 292 </File> 293 <File 294 RelativePath="..\..\src\core\input\InputCommands.cc" 295 > 296 </File> 297 <File 298 RelativePath="..\..\src\core\input\InputManager.cc" 299 > 300 </File> 301 <File 302 RelativePath="..\..\src\core\input\KeyBinder.cc" 303 > 304 </File> 305 <File 306 RelativePath="..\..\src\core\input\KeyDetector.cc" 291 307 > 292 308 </File> … … 331 347 </File> 332 348 <File 349 RelativePath="..\..\src\core\Core.h" 350 > 351 </File> 352 <File 333 353 RelativePath="..\..\src\core\CorePrereqs.h" 334 354 > 335 355 </File> 336 356 <File 337 RelativePath="..\..\src\core\CoreSettings.h"338 >339 </File>340 <File341 357 RelativePath="..\..\src\core\Debug.h" 342 358 > … … 374 390 > 375 391 </File> 376 <File377 RelativePath="..\..\src\core\Tickable.h"378 >379 </File>380 392 <Filter 381 393 Name="input" 382 394 > 383 395 <File 384 RelativePath="..\..\src\core\InputBuffer.h" 385 > 386 </File> 387 <File 388 RelativePath="..\..\src\core\InputInterfaces.h" 389 > 390 </File> 391 <File 392 RelativePath="..\..\src\core\InputManager.h" 393 > 394 </File> 395 <File 396 RelativePath="..\..\src\core\KeyBinder.h" 396 RelativePath="..\..\src\core\input\Button.h" 397 > 398 </File> 399 <File 400 RelativePath="..\..\src\core\input\CalibratorCallback.h" 401 > 402 </File> 403 <File 404 RelativePath="..\..\src\core\input\HalfAxis.h" 405 > 406 </File> 407 <File 408 RelativePath="..\..\src\core\input\InputBuffer.h" 409 > 410 </File> 411 <File 412 RelativePath="..\..\src\core\input\InputCommands.h" 413 > 414 </File> 415 <File 416 RelativePath="..\..\src\core\input\InputInterfaces.h" 417 > 418 </File> 419 <File 420 RelativePath="..\..\src\core\input\InputManager.h" 421 > 422 </File> 423 <File 424 RelativePath="..\..\src\core\input\KeyBinder.h" 425 > 426 </File> 427 <File 428 RelativePath="..\..\src\core\input\KeyDetector.h" 397 429 > 398 430 </File> -
code/trunk/visual_studio/vc8/orxonox.vcproj
r1502 r1535 184 184 </FileConfiguration> 185 185 </File> 186 <File 187 RelativePath="..\..\src\orxonox\Settings.cc" 188 > 189 </File> 186 190 <Filter 187 191 Name="hud" … … 253 257 <File 254 258 RelativePath="..\..\src\orxonox\objects\SpaceShipAI.cc" 259 > 260 </File> 261 <File 262 RelativePath="..\..\src\orxonox\objects\Tickable.cc" 255 263 > 256 264 </File> … … 466 474 > 467 475 </File> 476 <File 477 RelativePath="..\..\src\orxonox\Settings.h" 478 > 479 </File> 468 480 <Filter 469 481 Name="hud" … … 539 551 <File 540 552 RelativePath="..\..\src\orxonox\objects\SpaceShipAI.h" 553 > 554 </File> 555 <File 556 RelativePath="..\..\src\orxonox\objects\Tickable.h" 541 557 > 542 558 </File>
Note: See TracChangeset
for help on using the changeset viewer.