Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1374 for code/trunk/src


Ignore:
Timestamp:
May 22, 2008, 3:57:27 PM (17 years ago)
Author:
FelixSchulthess
Message:

added fps counter

Location:
code/trunk/src/orxonox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/Orxonox.cc

    r1362 r1374  
    487487//      orxonoxHUD_->setRocket2(ogreRoot.getCurrentFrameNumber());
    488488      if (eventTimes[3].back() - eventTimes[3].front() != 0)
    489 //        orxonoxHUD_->setRocket1((int)(50000.0f/(eventTimes[3].back() - eventTimes[3].front())));
     489        orxonoxHUD_->setFPS(50000.0f/(eventTimes[3].back() - eventTimes[3].front()));
    490490
    491491      // Iterate through all Tickables and call their tick(dt) function
  • code/trunk/src/orxonox/hud/HUD.cc

    r1362 r1374  
    6060        test->show();
    6161        test->setMetricsMode(Ogre::GMM_RELATIVE);
    62         test->setDimensions(0.8, 0.8);
     62        test->setDimensions(0.3, 0.3);
    6363        test->setPosition(0.02, 0.02);
    6464        test->setFontName("Console");
    6565        test->setCaption("init");
     66
     67        // test2
     68        fpsText = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "fpsText"));
     69        fpsText->show();
     70        fpsText->setMetricsMode(Ogre::GMM_RELATIVE);
     71        fpsText->setDimensions(0.3, 0.3);
     72        fpsText->setPosition(0.9, 0.02);
     73        fpsText->setFontName("Console");
     74        fpsText->setCaption("init");
    6675
    6776        // create energy bar
     
    8695        container->setMetricsMode(Ogre::GMM_RELATIVE);
    8796        container->addChild(test);
     97        container->addChild(fpsText);
    8898        energyBar->init(0.01, 0.94, 0.4, container);
    8999        energyBar->setValue(1);
     
    113123    }
    114124
     125    void HUD::setFPS(float fps){
     126        fpsText->setCaption("FPS: " + Ogre::StringConverter::toString(fps));
     127    }
     128
    115129    HUD::~HUD(void){
    116130    }
  • code/trunk/src/orxonox/hud/HUD.h

    r1362 r1374  
    5050            Ogre::OverlayContainer* container;
    5151            Ogre::TextAreaOverlayElement* test;
     52            Ogre::TextAreaOverlayElement* fpsText;
    5253            BarOverlayElement* energyBar;
    5354            BarOverlayElement* speedoBar;
     
    5758            HUD(int zoom);
    5859            ~HUD();
     60            void setFPS(float fps);
    5961            virtual void tick(float);
    6062
Note: See TracChangeset for help on using the changeset viewer.