Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2008, 10:08:42 PM (16 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
Location:
code/branches/network/src/orxonox
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/orxonox/GraphicsEngine.h

    r1293 r1414  
    7272            int getWindowWidth() const;
    7373            int getWindowHeight() const;
     74            float getAverageFPS() const
     75            { if (renderWindow_) return this->renderWindow_->getAverageFPS(); else return 0.0f; }
    7476
    7577            void windowMoved       (Ogre::RenderWindow* rw);
  • code/branches/network/src/orxonox/Main.cc

    r1293 r1414  
    3636#include <exception>
    3737
    38 #include "OrxonoxPlatform.h"
     38#include "util/OrxonoxPlatform.h"
    3939#include "core/SignalHandler.h"
    4040#include "Orxonox.h"
  • 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  }
  • code/branches/network/src/orxonox/OrxonoxPrereqs.h

    r1410 r1414  
    3535#define _OrxonoxPrereqs_H__
    3636
    37 #include "OrxonoxPlatform.h"
     37#include "util/OrxonoxPlatform.h"
    3838
    3939//-----------------------------------------------------------------------
  • code/branches/network/src/orxonox/OrxonoxStableHeaders.h

    r1219 r1414  
    3535#define _OrxonoxStableHeaders_H__
    3636
    37 #include "OrxonoxPlatform.h"
     37#include "util/OrxonoxPlatform.h"
    3838
    3939#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     
    109109#include "network/Synchronisable.h"
    110110
    111 #include "OrxonoxPlatform.h"
    112111#include "OrxonoxPrereqs.h"
    113112#include "tools/Timer.h"
  • code/branches/network/src/orxonox/hud/HUD.cc

    r1411 r1414  
    3838#include "core/ConsoleCommand.h"
    3939#include "objects/SpaceShip.h"
     40#include "GraphicsEngine.h"
    4041#include "BarOverlayElement.h"
    4142#include "RadarObject.h"
     
    129130
    130131        nav->update();
    131     }
    132132
    133     void HUD::setFPS(float fps){
     133        float fps = GraphicsEngine::getSingleton().getAverageFPS();
    134134        fpsText->setCaption("FPS: " + Ogre::StringConverter::toString(fps));
    135135    }
  • code/branches/network/src/orxonox/hud/HUD.h

    r1411 r1414  
    5858      public:
    5959        virtual void tick(float);
    60         void setFPS(float fps);
    6160        void addRadarObject(Vector3 pos);
    6261        RadarObject* getFirstRadarObject();
Note: See TracChangeset for help on using the changeset viewer.