Changeset 4766 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Jul 2, 2005, 11:54:41 AM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/defs/globals.h
r4176 r4766 2 2 \file globals.h 3 3 \brief This file defines some default values. 4 4 5 5 no Class is defined here. 6 6 */ … … 11 11 #define ORXONOX_STAFF "Patrick Boenzli - Captain\n" \ 12 12 "Benjamin Grauer - First Officer\n" \ 13 14 15 16 "many more\n" 13 "Christian Meyer - Engeneer\n" \ 14 "Nico Bernold - Physics\n" \ 15 "David Gruetter - The ProtoType\n" \ 16 "many more...\n" 17 17 18 #define DEFAULT_CONFIG_FILE "~/.orxonox/orxonox.conf" 19 #define DEFAULT_DATA_DIR "/usr/share/orxonox/data/" 20 #define DEFAULT_DATA_DIR_CHECKFILE "data.oxd" 18 #define DEFAULT_CONFIG_FILE "~/.orxonox/orxonox.conf" 19 #define DEFAULT_LOCK_FILE "~/.orxonox/orxonox.lock" 20 #define DEFAULT_DATA_DIR "/usr/share/orxonox/data/" 21 #define DEFAULT_DATA_DIR_CHECKFILE "data.oxd" 21 22 22 23 // Defines all the Sections of the Config (in Gui and ORxonox) 23 24 //! Name of Section Misc in the config-File 24 #define CONFIG_SECTION_MISC"misc"25 #define CONFIG_SECTION_MISC_KEYS"miscKeys"26 #define CONFIG_SECTION_PLAYER"player"27 #define CONFIG_SECTION_VIDEO"video"28 #define CONFIG_SECTION_VIDEO_ADVANCED"video_advanced"29 #define CONFIG_SECTION_AUDIO"audio"30 #define CONFIG_SECTION_EXEC"exec"31 #define CONFIG_SECTION_DATA"data"25 #define CONFIG_SECTION_MISC "misc" 26 #define CONFIG_SECTION_MISC_KEYS "miscKeys" 27 #define CONFIG_SECTION_PLAYER "player" 28 #define CONFIG_SECTION_VIDEO "video" 29 #define CONFIG_SECTION_VIDEO_ADVANCED "video_advanced" 30 #define CONFIG_SECTION_AUDIO "audio" 31 #define CONFIG_SECTION_EXEC "exec" 32 #define CONFIG_SECTION_DATA "data" 32 33 33 34 /* … … 35 36 Consider they may __not__ have any WhiteSpaces inside 36 37 */ 37 #define CONFIG_NAME_DATADIR "DataDir" 38 #define CONFIG_NAME_AUTO_UPDATE "Auto-Update" 39 #define CONFIG_NAME_FULLSCREEN "Fullscreen-mode" 40 #define CONFIG_NAME_RESOLUTION "Resolution" 41 #define CONFIG_NAME_WIREFRAME "WireFrame-mode" 42 #define CONFIG_NAME_SHADOWS "Shadows" 43 #define CONFIG_NAME_FOG "Fog" 44 #define CONFIG_NAME_REFLECTIONS "Reflections" 45 #define CONFIG_NAME_TEXTURES "TEXTURES" 46 #define CONFIG_NAME_TEXTURE_DETAIL "Texture-Detail" 47 #define CONFIG_NAME_MODEL_DETAIL "Model-Detail" 48 #define CONFIG_NAME_PARTICLES_ENABLED "Particles Enabled" 49 #define CONFIG_NAME_ANTI_ALIASING "Anti-Aliasing" 50 #define CONFIG_NAME_FILTER_METHOD "Filtering-Method" 51 #define CONFIG_NAME_DISABLE_AUDIO "Disable-Audio" 52 #define CONFIG_NAME_MUSIC_VOLUME "Music-Volume" 53 #define CONFIG_NAME_EFFECTS_VOLUME "Effects-Volume" 54 #define CONFIG_NAME_SAVE_SETTINGS "Save-Settings" 55 #define CONFIG_NAME_VERBOSE_MODE "Verbose-Mode" 56 #define CONFIG_NAME_ALWAYS_SHOW_GUI "Always-Show-The-Gui" 57 #define CONFIG_NAME_PLAYER_UP "Up" 58 #define CONFIG_NAME_PLAYER_DOWN "Down" 59 #define CONFIG_NAME_PLAYER_LEFT "Left" 60 #define CONFIG_NAME_PLAYER_RIGHT "Right" 61 #define CONFIG_NAME_PLAYER_FIRE "Fire" 62 #define CONFIG_NAME_PLAYER_NEXT_WEAPON "Next" 63 #define CONFIG_NAME_PLAYER_PREV_WEAPON "Prev" 64 #define CONFIG_NAME_QUIT "Quit" 65 #define CONFIG_NAME_PAUSE "Pause" 66 #define CONFIG_NAME_NEXT_WORLD "Next-World" 67 #define CONFIG_NAME_PREV_WORLD "Prev-World" 68 #define CONFIG_NAME_VIEW0 "view0" 69 #define CONFIG_NAME_VIEW1 "view1" 70 #define CONFIG_NAME_VIEW2 "view2" 71 #define CONFIG_NAME_VIEW3 "view3" 72 #define CONFIG_NAME_VIEW4 "view4" 73 #define CONFIG_NAME_VIEW5 "view5" 38 #define CONFIG_NAME_DATADIR "DataDir" 39 #define CONFIG_NAME_AUTO_UPDATE "Auto-Update" 40 #define CONFIG_NAME_FULLSCREEN "Fullscreen-mode" 41 #define CONFIG_NAME_RESOLUTION "Resolution" 42 #define CONFIG_NAME_WIREFRAME "WireFrame-mode" 43 #define CONFIG_NAME_SHADOWS "Shadows" 44 #define CONFIG_NAME_FOG "Fog" 45 #define CONFIG_NAME_REFLECTIONS "Reflections" 46 #define CONFIG_NAME_TEXTURES "TEXTURES" 47 #define CONFIG_NAME_TEXTURE_DETAIL "Texture-Detail" 48 #define CONFIG_NAME_MODEL_DETAIL "Model-Detail" 49 #define CONFIG_NAME_PARTICLES_ENABLED "Particles Enabled" 50 #define CONFIG_NAME_ANTI_ALIASING "Anti-Aliasing" 51 #define CONFIG_NAME_FILTER_METHOD "Filtering-Method" 52 #define CONFIG_NAME_DISABLE_AUDIO "Disable-Audio" 53 #define CONFIG_NAME_MUSIC_VOLUME "Music-Volume" 54 #define CONFIG_NAME_EFFECTS_VOLUME "Effects-Volume" 55 #define CONFIG_NAME_SAVE_SETTINGS "Save-Settings" 56 #define CONFIG_NAME_VERBOSE_MODE "Verbose-Mode" 57 #define CONFIG_NAME_ALWAYS_SHOW_GUI "Always-Show-The-Gui" 58 // evenets 59 #define CONFIG_NAME_PLAYER_UP "Up" 60 #define CONFIG_NAME_PLAYER_DOWN "Down" 61 #define CONFIG_NAME_PLAYER_LEFT "Left" 62 #define CONFIG_NAME_PLAYER_RIGHT "Right" 63 #define CONFIG_NAME_PLAYER_FIRE "Fire" 64 #define CONFIG_NAME_PLAYER_NEXT_WEAPON "Next" 65 #define CONFIG_NAME_PLAYER_PREV_WEAPON "Prev" 66 #define CONFIG_NAME_QUIT "Quit" 67 #define CONFIG_NAME_PAUSE "Pause" 68 #define CONFIG_NAME_NEXT_WORLD "Next-World" 69 #define CONFIG_NAME_PREV_WORLD "Prev-World" 70 #define CONFIG_NAME_VIEW0 "view0" 71 #define CONFIG_NAME_VIEW1 "view1" 72 #define CONFIG_NAME_VIEW2 "view2" 73 #define CONFIG_NAME_VIEW3 "view3" 74 #define CONFIG_NAME_VIEW4 "view4" 75 #define CONFIG_NAME_VIEW5 "view5" 74 76 75 77 -
orxonox/trunk/src/lib/graphics/graphics_engine.cc
r4747 r4766 92 92 */ 93 93 // setting up the Resolution 94 this->setResolution( 1000, 1000, 16);94 this->setResolution(550, 400, 16); 95 95 96 96 // TO DO: Create a cool icon and use it here -
orxonox/trunk/src/orxonox.cc
r4756 r4766 43 43 #include "cd_engine.h" 44 44 45 #include "substring.h" 45 46 #include "class_list.h" 46 47 … … 59 60 { 60 61 this->setClassID(CL_ORXONOX, "Orxonox"); 61 this->setName("orxonox ");62 this->setName("orxonox-main"); 62 63 63 64 this->resourceManager = NULL; 64 65 this->objectManager = NULL; 65 66 this->eventHandler = NULL; 67 this->iniParser = NULL; 66 68 67 69 this->argc = 0; … … 74 76 Orxonox::~Orxonox () 75 77 { 76 int i = 0;77 Orxonox::singletonRef = NULL; 78 delete this->iniParser; 79 78 80 delete GraphicsEngine::getInstance(); // deleting the Graphics 79 81 delete TextEngine::getInstance(); … … 84 86 delete EventHandler::getInstance(); 85 87 delete Factory::getFirst(); 88 delete SoundEngine::getInstance(); 86 89 87 90 ClassList::debug(0); 88 } 89 90 /** \brief this is a singleton class to prevent duplicates */ 91 Orxonox* Orxonox::singletonRef = 0; 92 93 /** 94 \returns reference or new Object of Orxonox if not existent.95 */ 96 Orxonox* Orxonox::getInstance () 97 { 98 if (singletonRef == NULL)99 singletonRef = new Orxonox();100 return singletonRef;101 } 102 103 /** 104 \brief this finds the config file105 106 Since the config file varies from user to user and since one may want to specify different config files107 for certain occasions or platforms this function finds the right config file for every occasion and stores108 it's path and name into configfilename 109 */ 110 void Orxonox::getConfigFile (int argc, char** argv) 111 { 112 strcpy (configfilename, "~/.orxonox/orxonox.conf");91 92 PRINT(3)("===================================================\n" \ 93 "Thanks for playing orxonox.\n" \ 94 "visit: http://www.orxonox.ethz.ch for new versions.\n" \ 95 "===================================================\n"); 96 97 Orxonox::singletonRef = NULL; 98 } 99 100 /** 101 * @brief this is a singleton class to prevent duplicates 102 */ 103 Orxonox* Orxonox::singletonRef = NULL; 104 105 /** 106 * @brief this finds the config file 107 * @returns the new config-fileName 108 * Since the config file varies from user to user and since one may want to specify different config files 109 * for certain occasions or platforms this function finds the right config file for every occasion and stores 110 * it's path and name into configfilename 111 */ 112 const char* Orxonox::getConfigFile (int argc, char** argv) 113 { 114 strcpy (this->configFileName, DEFAULT_CONFIG_FILE); 115 this->iniParser = new IniParser(this->configFileName); 113 116 } 114 117 … … 123 126 // config file 124 127 125 getConfigFile (argc, argv); 128 // initialize the Config-file 129 this->getConfigFile(argc, argv); 130 131 126 132 SDL_Init (SDL_INIT_TIMER); 127 133 // initialize everything 128 printf("> Initializing resources\n");129 134 if( initResources () == -1) return -1; 130 131 135 if( initVideo() == -1) return -1; 132 136 if( initSound() == -1) return -1; 133 PRINT(3)("> Initializing input\n");134 137 if( initInput() == -1) return -1; 135 PRINT(3)("> Initializing networking\n");136 138 if( initNetworking () == -1) return -1; 137 139 //printf("> Initializing world\n"); … … 149 151 150 152 GraphicsEngine::getInstance(); 151 GraphicsEngine::getInstance()->setWindowName("orxonox " PACKAGE_VERSION, "orxonox " PACKAGE_VERSION); 152 153 return 0; 154 } 155 153 GraphicsEngine::getInstance()->setWindowName(PACKAGE_NAME " " PACKAGE_VERSION, PACKAGE_NAME " " PACKAGE_VERSION); 154 155 156 SubString resolution(this->iniParser->getVar(CONFIG_NAME_RESOLUTION, CONFIG_SECTION_VIDEO, "640x480"), 'x'); 157 GraphicsEngine::getInstance()->setResolution(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16); 158 159 // const char* fullscreen = this->iniParser->getVar(CONFIG_NAME_FULLSCREEN, CONFIG_SECTION_VIDEO, 0); 160 // GraphicsEngine::getInstance()->setFullscreen(false); 161 162 return 0; 163 } 156 164 157 165 /** … … 168 176 169 177 /** 170 \brief initializes input functions178 * @brief initializes input functions 171 179 */ 172 180 int Orxonox::initInput() 173 181 { 182 PRINT(3)("> Initializing input\n"); 183 174 184 this->eventHandler = EventHandler::getInstance(); 175 185 this->eventHandler->init(); … … 180 190 181 191 /** 182 \brief initializes network system192 * @brief initializes network system 183 193 */ 184 194 int Orxonox::initNetworking() 185 195 { 186 printf("Not yet implemented\n"); 187 return 0; 188 } 189 190 191 /** 192 \brief initializes and loads resource files 193 */ 194 int Orxonox::initResources() 195 { 196 PRINT(3)("initializing ResourceManager\n"); 197 resourceManager = ResourceManager::getInstance(); 196 PRINT(3)("> Initializing networking\n"); 197 198 printf(" ---Not yet implemented-FIXME--\n"); 199 return 0; 200 } 201 202 203 /** 204 * @brief initializes and loads resource files 205 */ 206 int Orxonox::initResources() 207 { 208 PRINTF(3)("> Initializing resources\n"); 209 210 PRINT(3)("initializing ResourceManager\n"); 211 resourceManager = ResourceManager::getInstance(); 198 212 199 213 // create parser 200 IniParser parser (DEFAULT_CONFIG_FILE); 201 if( parser.getSection (CONFIG_SECTION_DATA) == -1) 202 { 203 PRINTF(1)("Could not find Section %s in %s\n", CONFIG_SECTION_DATA, DEFAULT_CONFIG_FILE); 204 return -1; 205 } 206 char namebuf[256]; 207 char valuebuf[256]; 208 memset (namebuf, 0, 256); 209 memset (valuebuf, 0, 256); 210 211 while( parser.nextVar (namebuf, valuebuf) != -1) 212 { 213 if (!strcmp(namebuf, CONFIG_NAME_DATADIR)) 214 { 214 if( this->iniParser->getSection (CONFIG_SECTION_DATA) == -1) 215 { 216 PRINTF(1)("Could not find Section %s in %s\n", CONFIG_SECTION_DATA, DEFAULT_CONFIG_FILE); 217 return -1; 218 } 219 char namebuf[256]; 220 char valuebuf[256]; 221 memset (namebuf, 0, 256); 222 memset (valuebuf, 0, 256); 223 224 while( this->iniParser->nextVar (namebuf, valuebuf) != -1) 225 { 226 if (!strcmp(namebuf, CONFIG_NAME_DATADIR)) 227 { 215 228 // printf("Not yet implemented\n"); 216 if (!resourceManager->setDataDir(valuebuf)) 217 { 218 PRINTF(1)("Data Could not be located\n"); 219 exit(-1); 220 } 221 } 222 223 memset (namebuf, 0, 256); 224 memset (valuebuf, 0, 256); 225 } 226 227 if (!resourceManager->checkDataDir(DEFAULT_DATA_DIR_CHECKFILE)) 228 { 229 PRINTF(1)("The DataDirectory %s could not be verified\nPlease Change in File %s Section %s Entry %s to a suitable value\n", 230 resourceManager->getDataDir(), 231 DEFAULT_CONFIG_FILE, 232 CONFIG_SECTION_DATA, 233 CONFIG_NAME_DATADIR); 234 exit(-1); 235 } 229 if (!resourceManager->setDataDir(valuebuf)) 230 { 231 PRINTF(1)("Data Could not be located\n"); 232 exit(-1); 233 } 234 } 235 236 memset (namebuf, 0, 256); 237 memset (valuebuf, 0, 256); 238 } 239 240 if (!resourceManager->checkDataDir(DEFAULT_DATA_DIR_CHECKFILE)) 241 { 242 PRINTF(1)("The DataDirectory %s could not be verified\n" \ 243 " Please Change in File %s Section %s Entry %s to a suitable value\n", 244 resourceManager->getDataDir(), 245 DEFAULT_CONFIG_FILE, 246 CONFIG_SECTION_DATA, 247 CONFIG_NAME_DATADIR); 248 exit(-1); 249 } 236 250 //! \todo this is a hack and should be loadable 237 resourceManager->addImageDir(ResourceManager::getInstance()->getFullName("maps/")); 238 resourceManager->debug(); 239 240 PRINT(3)("initializing TextEngine\n"); 241 TextEngine::getInstance(); 242 243 PRINT(3)("initializing ObjectManager\n"); 244 this->objectManager = ObjectManager::getInstance(); 245 246 CDEngine::getInstance(); 247 248 return 0; 249 } 250 251 252 251 resourceManager->addImageDir(ResourceManager::getInstance()->getFullName("maps/")); 252 resourceManager->debug(); 253 254 PRINT(3)("initializing TextEngine\n"); 255 TextEngine::getInstance(); 256 257 PRINT(3)("initializing ObjectManager\n"); 258 this->objectManager = ObjectManager::getInstance(); 259 260 CDEngine::getInstance(); 261 262 return 0; 263 } 253 264 254 265 /** … … 299 310 bool showGui = false; 300 311 312 313 314 /********************************** 315 *** ORXONOX MAIN STARTING POINT *** 316 **********************************/ 301 317 /** 302 318 \brief main function … … 306 322 int main(int argc, char** argv) 307 323 { 308 309 324 // here the pre-arguments are loaded, these are needed to go either to orxonx itself, Help, or Benchmark. 310 325 int i; … … 337 352 338 353 354 355 /** 356 * starts orxonox 357 * @param argc parameters count given to orxonox 358 * @param argv parameters given to orxonox 359 */ 339 360 int startOrxonox(int argc, char** argv) 340 361 { 341 362 // checking for existence of the configuration-files 342 363 if (showGui || 343 !ResourceManager::isFile( "~/.orxonox/orxonox.conf") ||344 ResourceManager::isFile( "~/.orxonox/orxonox.lock"))345 { 346 if (ResourceManager::isFile( "~/.orxonox/orxonox.lock"))347 ResourceManager::deleteFile( "~/.orxonox/orxonox.lock");364 !ResourceManager::isFile(DEFAULT_CONFIG_FILE) || 365 ResourceManager::isFile(DEFAULT_LOCK_FILE)) 366 { 367 if (ResourceManager::isFile(DEFAULT_LOCK_FILE)) 368 ResourceManager::deleteFile(DEFAULT_LOCK_FILE); 348 369 349 370 // starting the GUI … … 359 380 PRINT(0)(">>> Starting Orxonox <<<\n"); 360 381 361 ResourceManager::touchFile( "~/.orxonox/orxonox.lock");382 ResourceManager::touchFile(DEFAULT_LOCK_FILE); 362 383 363 384 Orxonox *orx = Orxonox::getInstance(); -
orxonox/trunk/src/orxonox.h
r4447 r4766 1 /*! 1 /*! 2 2 \file orxonox.h 3 3 \brief Orxonox core functions 4 */ 4 */ 5 5 6 6 #ifndef _ORXONOX_H … … 15 15 class EventHandler; 16 16 class Event; 17 class IniParser; 17 18 18 19 //! Orxonox core singleton class … … 22 23 23 24 public: 24 static Orxonox* getInstance ();25 25 virtual ~Orxonox (); 26 /** \returns a Pointer to the only object of this Class */ 27 inline static Orxonox* getInstance() { if (!singletonRef) singletonRef = new Orxonox(); return singletonRef; }; 28 26 29 int init (int argc, char** argv); 27 30 … … 34 37 Orxonox (); 35 38 39 void parseIniFile(const char* fileName); 40 36 41 int initVideo (); 37 42 int initSound (); … … 40 45 int initResources (); 41 46 42 voidgetConfigFile (int argc, char** argv);47 const char* getConfigFile (int argc, char** argv); 43 48 44 49 private: 45 50 static Orxonox* singletonRef; //!< singleton reference to orxonox 46 51 47 char configfilename[256]; //!< Filename of the configuration-file. 52 IniParser* iniParser; //!< Reference to the ini-parser used in orxonox 53 char configFileName[256]; //!< Filename of the configuration-file. 48 54 GameLoader* gameLoader; //!< The gameLoader 49 55 ResourceManager* resourceManager; //!< The ResourceManager 50 56 ObjectManager* objectManager; //!< the object manager of the game 51 57 EventHandler* eventHandler; //!< the eventhandler of orxonox is created here 52 58 53 59 unsigned int argc; //!< Count of Arguments of orxonox 54 60 char** argv; //!< Values of th Arguments of orxonox.
Note: See TracChangeset
for help on using the changeset viewer.