Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2008, 10:08:42 PM (17 years ago)
Author:
rgrieder
Message:
  • moved OrxonoxPlatform.h to util (didn't even notice util recently)
  • therefore was able to define uint32_t, etc. for all our libs in OrxonoxPlatform.h
  • made use of OgreRenderWindow::getAverageFPS() in HUD
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/orxonox/Orxonox.cc

    r1413 r1414  
    456456    // Contains the times of recently fired events
    457457    // eventTimes[4] is the list for the times required for the fps counter
    458     std::deque<unsigned long> eventTimes[4];
     458    std::deque<unsigned long> eventTimes[3];
    459459    // Clear event times
    460     for (int i = 0; i < 4; ++i)
     460    for (int i = 0; i < 3; ++i)
    461461      eventTimes[i].clear();
    462     // fill the fps time list with zeros
    463     for (int i = 0; i < 50; i++)
    464       eventTimes[3].push_back(0);
    465462
    466463    // use the ogre timer class to measure time.
     
    478475      // get current time
    479476      unsigned long now = timer_->getMilliseconds();
    480       eventTimes[3].push_back(now);
    481       eventTimes[3].erase(eventTimes[3].begin());
    482477
    483478      // create an event to pass to the frameStarted method in ogre
     
    487482
    488483      // show the current time in the HUD
    489 //      orxonoxHUD_->setTime((int)now, 0);
    490 //      orxonoxHUD_->setRocket2(ogreRoot.getCurrentFrameNumber());
    491       if (eventTimes[3].back() - eventTimes[3].front() != 0)
    492         HUD::getSingleton().setFPS(50000.0f/(eventTimes[3].back() - eventTimes[3].front()));
    493 
    494       // Iterate through all Tickables and call their tick(dt) function
     484      // HUD::getSingleton().setTime(now);
     485
     486      // Call those objects that need the real time
    495487      for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it)
    496488        it->tick((float)evt.timeSinceLastFrame * this->timefactor_);
    497       // Iterate through all TickableReals and call their tick(dt) function
     489      // Call the scene objects
    498490      for (Iterator<TickableReal> it = ObjectList<TickableReal>::start(); it; ++it)
    499491        it->tick((float)evt.timeSinceLastFrame);
     492      // TODO: currently a hack. Somehow the console doesn't work with OrxonoxClass
    500493      orxonoxConsole_->tick((float)evt.timeSinceLastFrame);
    501494
     
    504497      ogreRoot._fireFrameStarted(evt);
    505498
    506       // server still renders at the moment
    507       //if (mode_ != SERVER)
    508499      ogreRoot._updateAllRenderTargets(); // only render in non-server mode
    509500
     
    517508      // again, just to be sure ogre works fine
    518509      ogreRoot._fireFrameEnded(evt);
    519       //msleep(50);
    520510          }
    521511
    522     if(mode_==CLIENT)
     512    if (mode_==CLIENT)
    523513      network::Client::getSingleton()->closeConnection();
    524     else if(mode_==SERVER)
     514    else if (mode_==SERVER)
    525515      server_g->close();
     516
    526517    return true;
    527518  }
Note: See TracChangeset for help on using the changeset viewer.