Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jul 8, 2005, 11:19:49 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Singleton-Classes are now refered to as such in World and Orxonox

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

Legend:

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

    r4820 r4822  
    183183  ParticleEngine::getInstance()->debug();
    184184
    185   this->eventHandler->unsubscribe(this->localPlayer);
     185  EventHandler::getInstance()->unsubscribe(this->localPlayer);
    186186
    187187  delete WorldInterface::getInstance();
     
    189189  delete this->entities;
    190190  delete LightManager::getInstance();
    191   delete this->trackManager;
    192   delete this->particleEngine;
     191  delete TrackManager::getInstance();
     192  delete ParticleEngine::getInstance();
     193
    193194  TextEngine::getInstance()->flush();
    194195  SoundEngine::getInstance()->flushAllBuffers();
     
    292293  WorldInterface* wi = WorldInterface::getInstance();
    293294  wi->init(this);
    294   this->garbageCollector = GarbageCollector::getInstance();
    295 
    296   this->eventHandler = EventHandler::getInstance();
    297 
    298   this->particleEngine = ParticleEngine::getInstance();
    299   this->trackManager = TrackManager::getInstance();
     295
    300296  LightManager::getInstance();
    301297  this->nullParent = NullParent::getInstance ();
     
    439435      PRINTF(4)("Loading Track\n");
    440436
    441       trackManager->loadParams( element);
    442       trackManager->finalize();
     437      TrackManager::getInstance()->loadParams( element);
     438      TrackManager::getInstance()->finalize();
    443439    }
    444440
     
    449445
    450446  // bind input
    451   this->eventHandler->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_UP);
    452   this->eventHandler->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_DOWN);
    453   this->eventHandler->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_LEFT);
    454   this->eventHandler->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_RIGHT);
    455   this->eventHandler->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_FIRE1);
    456   this->eventHandler->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_NEXT_WEAPON);
    457   this->eventHandler->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_PREVIOUS_WEAPON);
     447  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_UP);
     448  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_DOWN);
     449  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_LEFT);
     450  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_RIGHT);
     451  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_FIRE1);
     452  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_NEXT_WEAPON);
     453  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_PREVIOUS_WEAPON);
    458454
    459455  // bind camera
     
    474470//   lightMan->setPosition(100, 80, 60);
    475471
    476   //        trackManager->setBindSlave(env);
    477   PNode* tn = trackManager->getTrackNode();
     472  //        TrackManager::getInstance()->setBindSlave(env);
     473  PNode* tn = TrackManager::getInstance()->getTrackNode();
    478474  tn->addChild(this->localPlayer);
    479475
     
    485481  this->localPlayer->setParentMode(PNODE_ALL);
    486482  Vector* cameraOffset = new Vector (0, 5, -10);
    487   trackManager->condition(1, LEFTRIGHT, this->localPlayer);
     483  TrackManager::getInstance()->condition(1, LEFTRIGHT, this->localPlayer);
    488484
    489485  this->sky->setParent(this->localCamera);
     
    493489  glNewList (objectList, GL_COMPILE);
    494490
    495   //trackManager->drawGraph(.01);
    496   //trackManager->debug(2);
     491  //TrackManager::getInstance()->drawGraph(.01);
     492  //TrackManager::getInstance()->debug(2);
    497493  glEndList();
    498494
     
    556552
    557553  // initializing the TrackManager
    558   this->trackManager = TrackManager::getInstance();
    559   //trackManager->addPointV(Vector(0,0,0));
    560   trackManager->addPointV(Vector(150, -35, 5));
    561   trackManager->addPointV(Vector(200,-35, 5));
    562   trackManager->addPointV(Vector(250, -35, 5));
    563   trackManager->addPointV(Vector(320,-33,-.55));
    564   trackManager->setDuration(1);
    565   trackManager->setSavePoint();
    566 
    567   trackManager->addPointV(Vector(410, 0, 0));
    568   trackManager->addPointV(Vector(510, 20, -10));
    569   trackManager->addPointV(Vector(550, 20, -10));
    570   trackManager->addPointV(Vector(570, 20, -10));
    571   trackManager->setDuration(2);
    572 
    573   trackManager->forkS("testFork1,testFork2");
    574   trackManager->workOnS("testFork1");
    575   trackManager->addPointV(Vector(640, 25, -30));
    576   trackManager->addPointV(Vector(700, 40, -120));
    577   trackManager->addPointV(Vector(800, 50, -150));
    578   trackManager->addPointV(Vector(900, 60, -100));
    579   trackManager->addPointV(Vector(900, 60, -70));
    580   trackManager->addPointV(Vector(990, 65, -15));
    581   trackManager->addPointV(Vector(1050, 65, -10));
    582   trackManager->addPointV(Vector(1100, 65, -20));
    583   trackManager->setDuration(4);
    584 
    585   trackManager->workOnS("testFork2");
    586   trackManager->addPointV(Vector(640, 25, 20));
    587   trackManager->addPointV(Vector(670, 50, 120));
    588   trackManager->addPointV(Vector(700, 70, 80));
    589   trackManager->addPointV(Vector(800, 70, 65));
    590   trackManager->addPointV(Vector(850, 65, 65));
    591   trackManager->addPointV(Vector(920, 35, 40));
    592   trackManager->addPointV(Vector(945, 40, 40));
    593   trackManager->addPointV(Vector(970, 24, 40));
    594   trackManager->addPointV(Vector(1000, 40, -7));
    595 
    596   trackManager->setDuration(4);
    597 
    598 
    599   trackManager->joinS("testFork1,testFork2");
    600 
    601   trackManager->addPointV(Vector(1200, 60, -50));
    602   trackManager->addPointV(Vector(1300, 50, -50));
    603   trackManager->addPointV(Vector(1400, 40, -50));
    604   trackManager->addPointV(Vector(1500, 40, -60));
    605   trackManager->addPointV(Vector(1600, 35, -55));
    606   trackManager->addPointV(Vector(1700, 45, -40));
    607   trackManager->addPointV(Vector(1750, 60, -40));
    608   trackManager->addPointV(Vector(1770, 80, -40));
    609   trackManager->addPointV(Vector(1800, 100, -40));
    610   trackManager->setDuration(10);
    611 
    612   trackManager->finalize();
     554  TrackManager::getInstance()->addPointV(Vector(150, -35, 5));
     555  TrackManager::getInstance()->addPointV(Vector(200,-35, 5));
     556  TrackManager::getInstance()->addPointV(Vector(250, -35, 5));
     557  TrackManager::getInstance()->addPointV(Vector(320,-33,-.55));
     558  TrackManager::getInstance()->setDuration(1);
     559  TrackManager::getInstance()->setSavePoint();
     560
     561  TrackManager::getInstance()->addPointV(Vector(410, 0, 0));
     562  TrackManager::getInstance()->addPointV(Vector(510, 20, -10));
     563  TrackManager::getInstance()->addPointV(Vector(550, 20, -10));
     564  TrackManager::getInstance()->addPointV(Vector(570, 20, -10));
     565  TrackManager::getInstance()->setDuration(2);
     566
     567  TrackManager::getInstance()->forkS("testFork1,testFork2");
     568  TrackManager::getInstance()->workOnS("testFork1");
     569  TrackManager::getInstance()->addPointV(Vector(640, 25, -30));
     570  TrackManager::getInstance()->addPointV(Vector(700, 40, -120));
     571  TrackManager::getInstance()->addPointV(Vector(800, 50, -150));
     572  TrackManager::getInstance()->addPointV(Vector(900, 60, -100));
     573  TrackManager::getInstance()->addPointV(Vector(900, 60, -70));
     574  TrackManager::getInstance()->addPointV(Vector(990, 65, -15));
     575  TrackManager::getInstance()->addPointV(Vector(1050, 65, -10));
     576  TrackManager::getInstance()->addPointV(Vector(1100, 65, -20));
     577  TrackManager::getInstance()->setDuration(4);
     578
     579  TrackManager::getInstance()->workOnS("testFork2");
     580  TrackManager::getInstance()->addPointV(Vector(640, 25, 20));
     581  TrackManager::getInstance()->addPointV(Vector(670, 50, 120));
     582  TrackManager::getInstance()->addPointV(Vector(700, 70, 80));
     583  TrackManager::getInstance()->addPointV(Vector(800, 70, 65));
     584  TrackManager::getInstance()->addPointV(Vector(850, 65, 65));
     585  TrackManager::getInstance()->addPointV(Vector(920, 35, 40));
     586  TrackManager::getInstance()->addPointV(Vector(945, 40, 40));
     587  TrackManager::getInstance()->addPointV(Vector(970, 24, 40));
     588  TrackManager::getInstance()->addPointV(Vector(1000, 40, -7));
     589
     590  TrackManager::getInstance()->setDuration(4);
     591
     592
     593  TrackManager::getInstance()->joinS("testFork1,testFork2");
     594
     595  TrackManager::getInstance()->addPointV(Vector(1200, 60, -50));
     596  TrackManager::getInstance()->addPointV(Vector(1300, 50, -50));
     597  TrackManager::getInstance()->addPointV(Vector(1400, 40, -50));
     598  TrackManager::getInstance()->addPointV(Vector(1500, 40, -60));
     599  TrackManager::getInstance()->addPointV(Vector(1600, 35, -55));
     600  TrackManager::getInstance()->addPointV(Vector(1700, 45, -40));
     601  TrackManager::getInstance()->addPointV(Vector(1750, 60, -40));
     602  TrackManager::getInstance()->addPointV(Vector(1770, 80, -40));
     603  TrackManager::getInstance()->addPointV(Vector(1800, 100, -40));
     604  TrackManager::getInstance()->setDuration(10);
     605
     606  TrackManager::getInstance()->finalize();
    613607
    614608
     
    639633
    640634
    641         this->eventHandler->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_FIRE1);
    642         this->eventHandler->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_NEXT_WEAPON);
    643         this->eventHandler->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_PREVIOUS_WEAPON);
     635        EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_FIRE1);
     636        EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_NEXT_WEAPON);
     637        EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_PREVIOUS_WEAPON);
    644638
    645639        /*
     
    679673        this->localCamera->lookAt(this->localPlayer);
    680674
    681         this->eventHandler->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_UP);
    682         this->eventHandler->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_DOWN);
    683         this->eventHandler->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_LEFT);
    684         this->eventHandler->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_RIGHT);
    685         this->eventHandler->subscribe(this->pilotNode, ES_GAME, EV_MOUSE_MOTION);
     675        EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_UP);
     676        EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_DOWN);
     677        EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_LEFT);
     678        EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_RIGHT);
     679        EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, EV_MOUSE_MOTION);
    686680
    687681        // bind input
     
    690684
    691685        /*
    692         PNode* tn = trackManager->getTrackNode();
     686        PNode* tn = TrackManager::getInstance()->getTrackNode();
    693687        tn->addChild(this->localPlayer);
    694688        this->localCamera->lookAt(tn);
     
    696690        tn->addChild(this->localCamera);
    697691        this->localPlayer->setParentMode(PNODE_ALL);
    698         trackManager->condition(2, LEFTRIGHT, this->localPlayer);
     692        TrackManager::getInstance()->condition(2, LEFTRIGHT, this->localPlayer);
    699693        */
    700694        this->glmis->step();
     
    889883  glCallList (objectList);
    890884
    891   particleEngine->draw(); //!< \todo should be dts like in the Trunk;
     885  ParticleEngine::getInstance()->draw(); //!< \todo should be dts like in the Trunk;
    892886
    893887  crosshair->draw();
     
    10751069
    10761070      /* update tick the rest */
    1077       this->trackManager->tick(this->dt);
     1071      TrackManager::getInstance()->tick(this->dt);
    10781072      this->localCamera->tick(this->dt);
    10791073      // tick the engines
     
    11071101void World::update()
    11081102{
    1109   this->garbageCollector->update();
     1103  GarbageCollector::getInstance()->update();
    11101104  this->nullParent->update (this->dtS);
    11111105
  • orxonox/trunk/src/story_entities/world.h

    r4765 r4822  
    1414class World;
    1515class WorldEntity;
    16 class TrackManager;
    1716class Camera;
    1817class Player;
    1918class PNode;
    2019class GLMenuImageScreen;
    21 class LightManager;
    22 class ParticleEngine;
    2320class Terrain;
    2421class GarbageCollector;
     
    2623class TiXmlElement;
    2724class PilotNode;
    28 class EventHandler;
    2925
    3026//! The game world Interface
     
    10298  Uint32 lastFrame;                   //!< last time of frame
    10399  Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
    104   Uint32 dt;                          //!< time needed to calculate this frame
     100  Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
    105101  float dtS;                          //!< The time needed for caluculations in seconds
    106102  double gameTime;                    //!< this is where the game time is saved
     
    115111  char* path;                         //!< The file from which this world is loaded
    116112
     113
     114  // IMPORTANT WORLD-ENTITIES
    117115  PNode* nullParent;                  //!< The zero-point, that everything has as its parent.
    118   TrackManager* trackManager;         //!< The reference of the TrackManager that handles the course through the Level.
    119   ParticleEngine* particleEngine;     //!< The ParticleEngine of the World.
    120116  Camera* localCamera;                //!< The current Camera
    121117  WorldEntity* sky;                   //!< The Environmental Heaven of orxonox \todo insert this to environment insted
    122   LightManager* lightMan;             //!< The Lights of the Level
    123118  Terrain* terrain;                   //!< The Terrain of the World.
    124119
     
    127122  Player* localPlayer;                //!< The Player, you fly through the level.
    128123  PilotNode* pilotNode;               //!< THe pilot node to fly with the mouse
    129 
    130   GarbageCollector* garbageCollector; //!< reference to the garbage  collector
    131   EventHandler* eventHandler;
    132124
    133125  /* function for main-loop */
Note: See TracChangeset for help on using the changeset viewer.