Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3646 in orxonox.OLD for orxonox/trunk/src/story_entities


Ignore:
Timestamp:
Mar 23, 2005, 5:43:07 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: implemented garbage collector, is not yet collecting, i have to update the list.h first.

Location:
orxonox/trunk/src/story_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/story_entities/world.cc

    r3644 r3646  
    2626#include "track_node.h"
    2727#include "world_entity.h"
    28 #include "track_manager.h"
    2928#include "player.h"
    3029#include "camera.h"
     
    3534#include "light.h"
    3635
     36#include "track_manager.h"
     37#include "garbage_collector.h"
     38
    3739#include "command_node.h"
    3840#include "glmenu_imagescreen.h"
     
    182184  WorldInterface* wi = WorldInterface::getInstance();
    183185  wi->init(this);
     186  this->garbageCollector = GarbageCollector::getInstance();
    184187}
    185188
     
    506509{
    507510  return this->entities;
     511}
     512
     513
     514/**
     515   \brief this returns the current game time
     516   \returns elapsed game time
     517*/
     518double World::getGameTime()
     519{
     520  return this->gameTime;
    508521}
    509522
     
    721734      this->dt = currentFrame - this->lastFrame;
    722735     
    723       if(dt > 0)
     736      if( this->dt > 0)
    724737        {
    725738          float fps = 1000/dt;
     
    733746          PRINTF(2)("fps = 1000 - frame rate is adjusted\n");
    734747          SDL_Delay(10);
    735           dt = 10;
     748          this->dt = 10;
    736749        }
    737750      //this->timeSlice (dt);
     
    739752      /* function to let all entities tick (iterate through list) */
    740753      WorldEntity* entity;
    741       float seconds = dt / 1000.0;     
     754      float seconds = this->dt / 1000.0;     
     755      this->gameTime += seconds;
    742756      entity = entities->enumerate();
    743757      while( entity != NULL)
     
    749763     
    750764      /* update tick the rest */
    751       this->trackManager->tick(dt);
    752       this->localCamera->tick(dt);
     765      this->trackManager->tick(this->dt);
     766      this->localCamera->tick(this->dt);
     767      this->garbageCollector->tick(seconds);
    753768    }
    754769  this->lastFrame = currentFrame;
     
    764779void World::update()
    765780{
     781  this->garbageCollector->update();
    766782  this->nullParent->update (dt);
    767783}
  • orxonox/trunk/src/story_entities/world.h

    r3644 r3646  
    2323class FontSet;
    2424class Terrain;
     25class GarbageCollector;
    2526
    2627//! The game world Interface
     
    5758  virtual ~World ();
    5859
     60  double getGameTime();
    5961
    6062  /* classes from story-entity */
     
    8890  Uint32 lastFrame;             //!< last time of frame
    8991  Uint32 dt;                    //!< time needed to calculate this frame
     92  double gameTime;              //!< this is where the game time is saved
    9093  bool bQuitOrxonox;            //!< quit this application
    9194  bool bQuitCurrentGame;        //!< quit only the current game and return to menu
     
    108111  tList<WorldEntity>* entities;//!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
    109112  WorldEntity* localPlayer;     //!< The Player, you fly through the level.
     113
     114  GarbageCollector* garbageCollector; //!< reference to the garbage  collector
    110115 
    111116  /* function for main-loop */
Note: See TracChangeset for help on using the changeset viewer.