Changeset 3302 in orxonox.OLD for orxonox/branches/parenting/src/world.cc
- Timestamp:
- Dec 27, 2004, 9:31:52 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/parenting/src/world.cc
r3277 r3302 36 36 World::World (char* name) 37 37 { 38 this->setClassName ("World"); 38 39 this->worldName = name; 39 40 this->debugWorldNr = -1; … … 132 133 { 133 134 this->nullParent = new NullParent (); 135 this->nullParent->setName ("NullParent"); 134 136 135 137 // create some path nodes … … 153 155 // create a player 154 156 WorldEntity* myPlayer = new Player(); 157 myPlayer->setName ("player"); 155 158 this->spawn(myPlayer); 156 159 this->localPlayer = myPlayer; … … 162 165 // bind camera 163 166 this->localCamera = new Camera(this); 164 this->getCamera()->bind (myPlayer); 167 this->localCamera->setName ("camera"); 168 this->getCamera()->bind (myPlayer); 169 this->localPlayer->addChild (this->localCamera); 165 170 166 171 /* … … 449 454 WorldEntity* entity; 450 455 456 ((WorldEntity*)this->nullParent)->processDraw (); 457 458 /* 451 459 entity = this->entities->enumerate(); 452 460 while( entity != NULL ) … … 455 463 entity = this->entities->nextElement(); 456 464 } 457 465 */ 458 466 459 467 // draw debug coord system … … 473 481 void World::update () 474 482 { 483 /* 475 484 //List<WorldEntity> *l; 476 485 WorldEntity* entity; … … 491 500 t = loc->part; 492 501 493 /* check if entity has still a legal track-id */494 502 if( t >= tracklen ) 495 503 { … … 514 522 else 515 523 { 516 /* \todo: implement check whether this particular free entity517 is out of the game area518 \todo: call function to notify the entity that it left519 the game area520 */521 524 } 522 525 523 526 entity = entities->nextElement(); 524 527 } 525 528 */ 526 529 } 527 530 … … 536 539 float seconds = deltaT / 1000.0; 537 540 541 this->nullParent->update (seconds); 542 this->nullParent->processTick (seconds); 543 538 544 entity = entities->enumerate(); 539 545 while( entity != NULL) … … 656 662 void World::mainLoop() 657 663 { 658 this->lastFrame = SDL_GetTicks ();664 this->lastFrame = SDL_GetTicks (); 659 665 printf("World::mainLoop() - Entering main loop\n"); 660 666 while( !this->bQuitOrxonox && !this->bQuitCurrentGame) /* \todo implement pause */ 661 667 { 662 668 // Network 663 synchronize();669 this->synchronize (); 664 670 // Process input 665 handleInput();671 this->handleInput (); 666 672 if( this->bQuitCurrentGame || this->bQuitOrxonox) 667 673 { … … 670 676 } 671 677 // Process time 672 t imeSlice();678 this->timeSlice (); 673 679 // Process collision 674 collision();680 this->collision (); 675 681 // Draw 676 display();677 678 for( int i = 0; i < 10000000; i++) {}682 this->display (); 683 684 for( int i = 0; i < 10000000; i++) {} 679 685 } 680 686 printf("World::mainLoop() - Exiting the main loop\n"); … … 792 798 this->nullParent->addChild (entity); 793 799 800 /* 794 801 entities->add (entity); 795 802 zeroloc.dist = 0; … … 803 810 this->track[loc->part].mapCoords( loc, entity->getPlacement()); 804 811 } 812 */ 805 813 entity->postSpawn (); 806 814 } … … 817 825 this->nullParent->addChild (entity); 818 826 819 Location zeroLoc;827 //Location zeroLoc; 820 828 WorldEntity* owner; 821 829 this->entities->add (entity); 830 /* 822 831 if( loc == NULL) 823 832 { … … 828 837 loc = &zeroLoc; 829 838 } 830 entity->init (loc, owner); 839 */ 840 //entity->init (loc, owner); 841 /* 831 842 if (entity->bFree) 832 843 { 833 844 this->track[loc->part].mapCoords( loc, entity->getPlacement()); 834 845 } 846 */ 835 847 entity->postSpawn (); 836 848 //return entity; … … 848 860 this->nullParent->addChild (entity); 849 861 862 /* 850 863 Placement zeroPlc; 851 864 WorldEntity* owner; … … 856 869 plc = &zeroPlc; 857 870 } 871 */ 858 872 this->entities->add (entity); 859 entity->init (plc, owner);873 //entity->init (plc, owner); 860 874 entity->postSpawn (); 861 875 //return entity;
Note: See TracChangeset
for help on using the changeset viewer.