Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3302 in orxonox.OLD for orxonox/branches/parenting/src/world.cc


Ignore:
Timestamp:
Dec 27, 2004, 9:31:52 PM (19 years ago)
Author:
patrick
Message:

orxonox/branches/parenting: implemented parenting and added to framework. sill got some problems with how to pass events through the new entity list (now part of the parenting-framework). changed to a more accurate way of coordinat-ing, the openGL coord-orientation. therefore the world is realy strange because it flies into the wrong direction.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/parenting/src/world.cc

    r3277 r3302  
    3636World::World (char* name)
    3737{
     38  this->setClassName ("World");
    3839  this->worldName = name;
    3940  this->debugWorldNr = -1;
     
    132133          {
    133134            this->nullParent = new NullParent ();
     135            this->nullParent->setName ("NullParent");
    134136
    135137            // create some path nodes
     
    153155            // create a player
    154156            WorldEntity* myPlayer = new Player();
     157            myPlayer->setName ("player");
    155158            this->spawn(myPlayer);
    156159            this->localPlayer = myPlayer;           
     
    162165            // bind camera
    163166            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);
    165170           
    166171            /*
     
    449454  WorldEntity* entity;
    450455 
     456  ((WorldEntity*)this->nullParent)->processDraw ();
     457
     458  /*
    451459  entity = this->entities->enumerate();
    452460  while( entity != NULL )
     
    455463      entity = this->entities->nextElement();
    456464    }
    457  
     465  */
    458466 
    459467  // draw debug coord system
     
    473481void World::update ()
    474482{
     483  /*
    475484  //List<WorldEntity> *l;
    476485  WorldEntity* entity;
     
    491500          t = loc->part;
    492501         
    493           /* check if entity has still a legal track-id */
    494502          if( t >= tracklen )
    495503            {
     
    514522      else
    515523        {
    516           /* \todo: implement check whether this particular free entity
    517              is out of the game area
    518              \todo: call function to notify the entity that it left
    519              the game area
    520           */
    521524        }
    522525     
    523526      entity = entities->nextElement();
    524527    }
    525  
     528  */ 
    526529}
    527530
     
    536539  float seconds = deltaT / 1000.0;
    537540 
     541  this->nullParent->update (seconds);
     542  this->nullParent->processTick (seconds);
     543
    538544  entity = entities->enumerate();
    539545  while( entity != NULL)
     
    656662void World::mainLoop()
    657663{
    658   this->lastFrame = SDL_GetTicks();
     664  this->lastFrame = SDL_GetTicks ();
    659665  printf("World::mainLoop() - Entering main loop\n");
    660666  while( !this->bQuitOrxonox && !this->bQuitCurrentGame) /* \todo implement pause */
    661667    {
    662668      // Network
    663       synchronize();
     669      this->synchronize ();
    664670      // Process input
    665       handleInput();
     671      this->handleInput ();
    666672      if( this->bQuitCurrentGame || this->bQuitOrxonox)
    667673        {
     
    670676        }
    671677      // Process time
    672       timeSlice();
     678      this->timeSlice ();
    673679      // Process collision
    674       collision();
     680      this->collision ();
    675681      // Draw
    676       display();
    677  
    678       for(int i = 0; i < 10000000; i++) {}
     682      this->display ();
     683 
     684      for( int i = 0; i < 10000000; i++) {}
    679685    }
    680686  printf("World::mainLoop() - Exiting the main loop\n");
     
    792798    this->nullParent->addChild (entity);
    793799
     800  /*
    794801  entities->add (entity);
    795802  zeroloc.dist = 0;
     
    803810      this->track[loc->part].mapCoords( loc, entity->getPlacement());
    804811    }
     812  */
    805813  entity->postSpawn ();
    806814}
     
    817825    this->nullParent->addChild (entity);
    818826
    819   Location zeroLoc;
     827  //Location zeroLoc;
    820828  WorldEntity* owner;
    821829  this->entities->add (entity);
     830  /*
    822831  if( loc == NULL)
    823832    {
     
    828837      loc = &zeroLoc;
    829838    }
    830   entity->init (loc, owner);
     839  */
     840  //entity->init (loc, owner);
     841  /*
    831842  if (entity->bFree)
    832843    {
    833844      this->track[loc->part].mapCoords( loc, entity->getPlacement());
    834845    }
     846  */
    835847  entity->postSpawn ();
    836848  //return entity;
     
    848860    this->nullParent->addChild (entity);
    849861
     862  /*
    850863  Placement zeroPlc;
    851864  WorldEntity* owner;
     
    856869      plc = &zeroPlc;
    857870    }
     871  */
    858872  this->entities->add (entity);
    859   entity->init (plc, owner);
     873  //entity->init (plc, owner);
    860874  entity->postSpawn ();
    861875  //return entity;
Note: See TracChangeset for help on using the changeset viewer.