Changeset 3646 in orxonox.OLD for orxonox/trunk/src/story_entities
- Timestamp:
- Mar 23, 2005, 5:43:07 PM (20 years ago)
- Location:
- orxonox/trunk/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/story_entities/world.cc
r3644 r3646 26 26 #include "track_node.h" 27 27 #include "world_entity.h" 28 #include "track_manager.h"29 28 #include "player.h" 30 29 #include "camera.h" … … 35 34 #include "light.h" 36 35 36 #include "track_manager.h" 37 #include "garbage_collector.h" 38 37 39 #include "command_node.h" 38 40 #include "glmenu_imagescreen.h" … … 182 184 WorldInterface* wi = WorldInterface::getInstance(); 183 185 wi->init(this); 186 this->garbageCollector = GarbageCollector::getInstance(); 184 187 } 185 188 … … 506 509 { 507 510 return this->entities; 511 } 512 513 514 /** 515 \brief this returns the current game time 516 \returns elapsed game time 517 */ 518 double World::getGameTime() 519 { 520 return this->gameTime; 508 521 } 509 522 … … 721 734 this->dt = currentFrame - this->lastFrame; 722 735 723 if( dt > 0)736 if( this->dt > 0) 724 737 { 725 738 float fps = 1000/dt; … … 733 746 PRINTF(2)("fps = 1000 - frame rate is adjusted\n"); 734 747 SDL_Delay(10); 735 dt = 10;748 this->dt = 10; 736 749 } 737 750 //this->timeSlice (dt); … … 739 752 /* function to let all entities tick (iterate through list) */ 740 753 WorldEntity* entity; 741 float seconds = dt / 1000.0; 754 float seconds = this->dt / 1000.0; 755 this->gameTime += seconds; 742 756 entity = entities->enumerate(); 743 757 while( entity != NULL) … … 749 763 750 764 /* 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); 753 768 } 754 769 this->lastFrame = currentFrame; … … 764 779 void World::update() 765 780 { 781 this->garbageCollector->update(); 766 782 this->nullParent->update (dt); 767 783 } -
orxonox/trunk/src/story_entities/world.h
r3644 r3646 23 23 class FontSet; 24 24 class Terrain; 25 class GarbageCollector; 25 26 26 27 //! The game world Interface … … 57 58 virtual ~World (); 58 59 60 double getGameTime(); 59 61 60 62 /* classes from story-entity */ … … 88 90 Uint32 lastFrame; //!< last time of frame 89 91 Uint32 dt; //!< time needed to calculate this frame 92 double gameTime; //!< this is where the game time is saved 90 93 bool bQuitOrxonox; //!< quit this application 91 94 bool bQuitCurrentGame; //!< quit only the current game and return to menu … … 108 111 tList<WorldEntity>* entities;//!< A template List of all entities. Every moving thing should be included here, and world automatically updates them. 109 112 WorldEntity* localPlayer; //!< The Player, you fly through the level. 113 114 GarbageCollector* garbageCollector; //!< reference to the garbage collector 110 115 111 116 /* function for main-loop */
Note: See TracChangeset
for help on using the changeset viewer.