Changeset 3214 in orxonox.OLD for orxonox/trunk/src/orxonox.cc
- Timestamp:
- Dec 18, 2004, 3:28:01 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/orxonox.cc
r3213 r3214 74 74 void Orxonox::get_config_file (int argc, char** argv) 75 75 { 76 /* char* path;77 #ifdef __WIN32__78 path = getenv("");79 #else80 path = getenv("HOME");81 #endif82 83 if( path != NULL) strcpy (configfilename, path);84 else strcpy (configfilename, "./");85 strcat (configfilename, "/.orxonox.conf");*/86 87 76 strcpy (configfilename, "orxonox.conf"); 88 77 } … … 176 165 } 177 166 167 178 168 /** 179 169 \brief initializes the sound engine … … 187 177 } 188 178 179 189 180 /** 190 181 \brief initializes input functions … … 198 189 } 199 190 191 200 192 /** 201 193 \brief initializes network system … … 207 199 } 208 200 201 209 202 /** 210 203 \brief initializes and loads resource files … … 215 208 return 0; 216 209 } 210 217 211 218 212 /** … … 247 241 } 248 242 243 249 244 /** 250 245 \brief exits Orxonox … … 255 250 } 256 251 257 /** 258 \brief this runs all of Orxonox 259 */ 260 void Orxonox::mainLoop() 261 { 262 lastframe = SDL_GetTicks(); 263 bQuitOrxonox = false; 264 // This is where everything is run 265 printf("Orxonox|Entering main loop\n"); 266 while( !bQuitOrxonox) 267 { 268 // Network 269 synchronize(); 270 // Process input 271 handle_input(); 272 // Process time 273 time_slice(); 274 // Process collision 275 collision(); 276 // Draw 277 display(); 278 } 279 printf("Orxonox|Exiting the main loop\n"); 280 } 252 281 253 282 254 /** … … 288 260 // Handle special events such as reshape, quit, focus changes 289 261 } 290 291 /** 292 \brief synchronize local data with remote data 293 */ 294 void Orxonox::synchronize () 295 { 296 // Get remote input 297 // Update synchronizables 298 } 299 300 /** 301 \brief run all input processing 302 */ 303 void Orxonox::handle_input () 304 { 305 // localinput 306 //localinput->process(); 307 // remoteinput 308 } 309 310 /** 311 \brief advance the timeline 312 */ 313 void Orxonox::time_slice () 314 { 315 Uint32 curframe = SDL_GetTicks(); 316 if( !pause) 317 { 318 Uint32 dt = curframe - lastframe; 319 320 if(dt > 0) 321 { 322 float fps = 1000/dt; 323 printf("fps = %f\n", fps); 324 } 325 326 world->time_slice (dt); 327 world->update (); 328 localcamera->time_slice (dt); 329 } 330 lastframe = curframe; 331 } 332 333 /** 334 \brief compute collision detection 335 */ 336 void Orxonox::collision () 337 { 338 world->collide (); 339 } 262 340 263 341 264 /** … … 354 277 } 355 278 356 /**357 \brief render the current frame358 */359 void Orxonox::display ()360 {361 // clear buffer362 glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);363 // set camera364 localcamera->apply ();365 // draw world366 world->draw ();367 // draw HUD368 // flip buffers369 SDL_GL_SwapBuffers();370 }371 279 372 280 /** … … 379 287 } 380 288 289 381 290 /** 382 291 \brief retrieve a pointer to the local CommandNode … … 388 297 } 389 298 299 390 300 /** 391 301 \brief retrieve a pointer to the local World … … 396 306 return world; 397 307 } 308 309 310 398 311 399 312 int main (int argc, char** argv)
Note: See TracChangeset
for help on using the changeset viewer.