Changeset 4830 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- Jul 11, 2005, 5:43:37 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/graphics_engine.cc
r4817 r4830 67 67 } 68 68 69 /** 70 * initializes the GraphicsEngine with default settings. 71 */ 69 72 int GraphicsEngine::init() 70 73 { 71 this->initVideo(640,480,16); 72 } 74 if (this->isInit) 75 return -1; 76 this->initVideo(640, 480, 16); 77 this->isInit = true; 78 } 79 80 /** 81 * loads the GraphicsEngine's settings from a given ini-file and section 82 * @param iniParser the iniParser to load from 83 * @param section the Section in the ini-file to load from 84 * @returns nothing usefull 85 */ 86 int GraphicsEngine::initFromIniFile(IniParser* iniParser) 87 { 88 89 // looking if we are in fullscreen-mode 90 const char* fullscreen = iniParser->getVar(CONFIG_NAME_FULLSCREEN, CONFIG_SECTION_VIDEO, "0"); 91 if (strchr(fullscreen, '1')) 92 this->fullscreenFlag = SDL_FULLSCREEN; 93 94 95 96 // looking if we are in fullscreen-mode 97 const char* textures = iniParser->getVar(CONFIG_NAME_TEXTURES, CONFIG_SECTION_VIDEO_ADVANCED, "0"); 98 if (strchr(textures, '1')) 99 this->texturesEnabled = true; 100 else 101 this->texturesEnabled = false; 102 103 // searching for a usefull resolution 104 SubString resolution(iniParser->getVar(CONFIG_NAME_RESOLUTION, CONFIG_SECTION_VIDEO, "640x480"), 'x'); 105 this->initVideo(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16); 106 } 107 108 73 109 74 110 /** … … 123 159 124 160 /** 125 * loads the GraphicsEngine's settings from a given ini-file and section126 * @param iniParser the iniParser to load from127 * @param section the Section in the ini-file to load from128 * @returns nothing usefull129 */130 int GraphicsEngine::initFromIniFile(IniParser* iniParser)131 {132 // searching for a usefull resolution133 SubString resolution(iniParser->getVar(CONFIG_NAME_RESOLUTION, CONFIG_SECTION_VIDEO, "640x480"), 'x');134 this->initVideo(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16);135 136 // looking if we are in fullscreen-mode137 const char* fullscreen = iniParser->getVar(CONFIG_NAME_FULLSCREEN, CONFIG_SECTION_VIDEO, "0");138 if (strchr(fullscreen, '1'))139 this->setFullscreen(true);140 141 // looking if we are in fullscreen-mode142 const char* textures = iniParser->getVar(CONFIG_NAME_TEXTURES, CONFIG_SECTION_VIDEO_ADVANCED, "0");143 if (strchr(textures, '1'))144 this->texturesEnabled = true;145 else146 this->texturesEnabled = false;147 148 }149 150 151 152 /**153 161 * sets the Window Captions and the Name of the icon. 154 162 * @param windowName The name of the Window -
orxonox/trunk/src/lib/graphics/importer/model.h
r4806 r4830 26 26 * \todo implement this stuff 27 27 */ 28 typedef enum MODEL_TYPE {MODEL_DISPLAY_LIST, 29 MODEL_VERTEX_ARRAY}; 28 typedef enum MODEL_TYPE { 29 MODEL_DISPLAY_LIST, 30 MODEL_VERTEX_ARRAY 31 }; 30 32 31 33 … … 36 38 37 39 //! an enumerator for VERTEX_FORMAT 38 typedef enum VERTEX_FORMAT { VERTEX_ONLY = VERTEX, 39 VERTEX_NORMAL = NORMAL, 40 VERTEX_TEXCOORD = TEXCOORD, 41 VERTEX_TEXCOORD_NORMAL = NORMAL | TEXCOORD }; 40 typedef enum VERTEX_FORMAT { 41 VERTEX_ONLY = VERTEX, 42 VERTEX_NORMAL = NORMAL, 43 VERTEX_TEXCOORD = TEXCOORD, 44 VERTEX_TEXCOORD_NORMAL = NORMAL | TEXCOORD 45 }; 42 46 43 47 //////////////////// -
orxonox/trunk/src/lib/graphics/text_engine.cc
r4746 r4830 254 254 glTranslatef(pos.x, pos.y, 0); 255 255 256 c har* tmpText = this->text;256 const char* tmpText = this->text; 257 257 while (*tmpText != '\0') 258 258 { … … 921 921 // drawing all the texts 922 922 tIterator<Text>* textIterator = textList->getIterator(); 923 Text* text = textIterator->nextElement();924 while( text != NULL)925 { 926 text->draw();927 text = textIterator->nextElement();923 Text* drawText = textIterator->nextElement(); 924 while( drawText != NULL) 925 { 926 drawText->draw(); 927 drawText = textIterator->nextElement(); 928 928 } 929 929 delete textIterator; -
orxonox/trunk/src/lib/gui/gui_exec.cc
r4746 r4830 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 16 16 You should have received a copy of the GNU General Public License 17 17 along with this program; if not, write to the Free Software Foundation, 18 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 19 20 20 … … 38 38 HashTable* orxonoxFlagHash; 39 39 40 /** 40 /** 41 41 \brief Creates the Exec-Frame 42 42 */ … … 59 59 CheckButton* alwaysShow; //!< A CheckButton, for if orxonox should start with or without gui. 60 60 Button* quit; //!< A Button to quit the Gui without starting orxonox. 61 61 62 62 start = new Button("Start"); 63 63 #ifdef HAVE_GTK2 … … 73 73 verboseMode = new Menu(CONFIG_NAME_VERBOSE_MODE, "nothing", 74 74 #if DEBUG >=1 75 75 "error", 76 76 #endif 77 77 #if DEBUG >=2 78 78 "warning", 79 79 #endif 80 80 #if DEBUG >=3 81 81 "info", 82 82 #endif 83 83 #if DEBUG >=4 84 84 "debug", 85 85 #endif 86 86 #if DEBUG >=5 87 88 #endif 89 87 "heavydebug", 88 #endif 89 "lastItem"); 90 90 verboseMode->setFlagName("verbose", "v", 2); 91 91 verboseMode->setDescription("Sets the Output Mode", "This Enables Outbug messages\n" 92 92 "0: nothing will be displayed, but stuff one cannot do without (eg.GUI)\n" 93 93 #if DEBUG >=1 94 94 "1: error: outputs all the above and errors" 95 95 #endif 96 96 #if DEBUG >=2 97 97 "2: warning: outputs all the above plus warnings" 98 98 #endif 99 99 #if DEBUG >=3 100 100 "3: info: outputs all the above plus Information" 101 101 #endif 102 102 #if DEBUG >=4 103 103 "4: debug: displays all the above plus debug information" 104 104 #endif 105 105 #if DEBUG >=5 106 107 #endif 108 106 "5: heavydebug: displays all the above plus heavy debug information: WARNING: the game will run very slow with this." 107 #endif 108 ); 109 109 verboseMode->saveability(); 110 110 execBox->fill(verboseMode); … … 152 152 153 153 PRINTF(5)("Config Directory is: %s.\n", this->confDir); 154 //! \todo F** Windows-support154 //! @todo F** Windows-support 155 155 #ifndef __WIN32__ 156 156 mkdir(this->confDir, 0755); … … 192 192 } 193 193 194 /** 194 /** 195 195 \brief Saves the configuration-file to the Disk.\n 196 196 \param widget from which Widget on should be saved. … … 215 215 int counter = 0; 216 216 while(counter < depth &&((widget->optionType > GUI_NOTHING 217 218 219 217 &&(static_cast<Option*>(widget)->isSaveable())) 218 ||(widget->optionType < GUI_NOTHING 219 && static_cast<Packer*>(widget)->getGroupName()))) 220 220 { 221 221 fprintf(this->CONFIG_FILE, " ", depth); 222 222 counter++; 223 223 } 224 224 225 225 // check if it is a Packer, and if it is, check if it has a name and if there is something in it. 226 226 if(widget->optionType < GUI_NOTHING) 227 227 { 228 228 if(static_cast<Packer*>(widget)->getGroupName()) 229 230 231 232 233 229 { 230 fprintf(CONFIG_FILE, "[%s]\n", static_cast<Packer*>(widget)->getGroupName()); 231 this->writeFileText(static_cast<Packer*>(widget)->down, depth+1); 232 fprintf(CONFIG_FILE, "\n"); 233 } 234 234 else 235 236 237 238 } 235 { 236 this->writeFileText(static_cast<Packer*>(widget)->down, depth); 237 } 238 } 239 239 240 240 if(widget->optionType > GUI_NOTHING) 241 241 if (static_cast<Option*>(widget)->isSaveable()) 242 242 { 243 244 245 246 247 248 249 250 251 252 243 char Buffer[256]; 244 char* space2under; 245 strcpy(Buffer, static_cast<Option*>(widget)->title); 246 if(strchr(Buffer, '_')) 247 PRINTF(2)("Optionname %s is not Valid for Saving, because it includes an underscore\n", Buffer); 248 while(space2under = strchr(Buffer, ' ')) 249 { 250 space2under[0] = '_'; 251 } 252 fprintf(CONFIG_FILE, "%s = %s\n", Buffer, static_cast<Option*>(widget)->save()); 253 253 } 254 254 … … 272 272 char* Value; 273 273 while(fscanf(this->CONFIG_FILE, "%s", Buffer) != EOF) 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 274 { 275 // group-search // 276 if(!strncmp(Buffer, "[", 1)) 277 { 278 if((groupWidget = locateGroup(widget, Buffer, 1))==NULL) 279 { 280 PRINTF(2)("!!There is no group called %s in this GUI.\n First best Widget will get the Infos assigned.\n Config-File will be updated in next Save\n", Buffer); 281 groupWidget = widget; 282 } 283 else 284 PRINT(5)("Group %s located.\n", static_cast<Packer*>(groupWidget)->groupName); 285 } 286 // option-setting // 287 if(!strcmp(Buffer, "=")) 288 { 289 char* under2space; 290 while(under2space = strchr(Variable, '_')) 291 { 292 sprintf(under2space, " %s", under2space+1); 293 } 294 295 fscanf(this->CONFIG_FILE, "%s", Buffer); 296 varInfo.variableName = Variable; 297 varInfo.variableValue = Buffer; 298 groupWidget->walkThrough(this->readFileText, &varInfo, 0); 299 sprintf(Variable, ""); 300 } 301 sprintf(Variable, "%s", Buffer); 302 } 303 303 widget->walkThrough(widget->setOptions, 0); 304 304 } 305 fclose(this->CONFIG_FILE); 305 306 } 306 307 … … 317 318 PRINT(5)("Located Option %s.\n", widget->title); 318 319 if(widget->optionType > GUI_NOTHING) 319 320 static_cast<Option*>(widget)->load(info->variableValue); 320 321 } 321 322 } … … 344 345 { 345 346 if(static_cast<Packer*>(widget)->getGroupName() && 346 347 348 349 347 !strcmp(groupName, static_cast<Packer*>(widget)->getGroupName())) 348 { 349 return widget; 350 } 350 351 else 351 352 353 354 355 } 356 352 { 353 if((tmp = locateGroup(static_cast<Packer*>(widget)->down, groupName, depth+1)) != NULL) 354 return tmp; 355 } 356 } 357 357 358 if(widget->next != NULL && depth != 0) 358 359 { 359 360 if((tmp = locateGroup(widget->next, groupName, depth)) != NULL) 360 361 return tmp; 361 362 } 362 363 return NULL; -
orxonox/trunk/src/lib/sound/sound_engine.cc
r4746 r4830 378 378 void SoundEngine::flushAllBuffers() 379 379 { 380 380 tIterator<SoundBuffer>* bufferIterator = this->bufferList->getIterator(); 381 381 SoundBuffer* enumBuffer = bufferIterator->nextElement(); 382 382 while (enumBuffer) … … 389 389 390 390 /** 391 * @brief SourceEngine::flushAllBuffers 392 */ 393 void SoundEngine::flushAllSources() 394 { 395 tIterator<SoundSource>* Iterator = this->sourceList->getIterator(); 396 SoundSource* enumSource = Iterator->nextElement(); 397 while (enumSource) 398 { 399 delete enumSource; 400 enumSource = Iterator->nextElement(); 401 } 402 delete Iterator; 403 } 404 405 406 /** 391 407 \brief initializes Audio in general 392 408 */ -
orxonox/trunk/src/lib/sound/sound_engine.h
r4761 r4830 91 91 void flushUnusedBuffers(); 92 92 void flushAllBuffers(); 93 void flushAllSources(); 93 94 bool initAudio(); 94 95 -
orxonox/trunk/src/lib/util/substring.cc
r4734 r4830 29 29 SubString::SubString( const char* string, char splitter) 30 30 { 31 n= 0;31 this->splittersCount = 0; 32 32 33 33 assert( string != NULL); 34 34 35 for( int i = 0; i < strlen(string); i++) if( string[i] == splitter) n++; 35 for( int i = 0; i < strlen(string); i++) if( string[i] == splitter) 36 splittersCount++; 36 37 37 n+= 1;38 this->splittersCount += 1; 38 39 39 strings = new char*[n]; 40 40 this->strings = new char*[this->splittersCount]; 41 41 assert (strings != NULL); 42 42 … … 48 48 while( end != NULL) 49 49 { 50 assert( i < n);50 assert( i < this->splittersCount); 51 51 l = end - offset; 52 strings[i] = new char[l + 1];52 this->strings[i] = new char[l + 1]; 53 53 assert( strings[i] != NULL); 54 54 strncpy( strings[i], offset, l); … … 71 71 SubString::~SubString() 72 72 { 73 for( int i = 0; i < n; i++)73 for( int i = 0; i < this->splittersCount; i++) 74 74 { 75 delete strings[i];75 delete this->strings[i]; 76 76 } 77 77 78 delete strings; 79 } 80 81 /** 82 \brief get the amount of substrings 83 \returns the amount of substrings 84 */ 85 int SubString::getCount() 86 { 87 return n; 78 delete this->strings; 88 79 } 89 80 … … 95 86 const char* SubString::getString( int i) 96 87 { 97 if( i < n && i >= 0) return strings[i]; 98 else return NULL; 88 if( i < this->splittersCount && i >= 0) 89 return this->strings[i]; 90 else 91 return NULL; 99 92 } -
orxonox/trunk/src/lib/util/substring.h
r4734 r4830 14 14 ~SubString(); 15 15 16 in t getCount();16 inline int getCount() { return this->splittersCount; }; 17 17 const char* getString( int i); 18 18 19 19 private: 20 char** strings; //!< strings produced from a single string splitted in multiple strings21 int n; //!< how many splitted parts20 char** strings; //!< strings produced from a single string splitted in multiple strings 21 int splittersCount; //!< how many splitted parts 22 22 }; 23 23
Note: See TracChangeset
for help on using the changeset viewer.