Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 1, 2005, 11:51:44 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: graphicsEngine and TextEngine documented

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/graphics_engine.cc

    r4374 r4458  
    165165}
    166166
     167/**
     168   \brief sets Fullscreen mode
     169   \param fullscreen true if fullscreen, false if windowed
     170*/
    167171void GraphicsEngine::setFullscreen(bool fullscreen)
    168172{
     
    171175}
    172176
     177/**
     178   \brief sets the background color
     179   \param red the red part of the background
     180   \param blue the blue part of the background
     181   \param green the green part of the background
     182   \param alpha the alpha part of the background
     183*/
    173184void GraphicsEngine::setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
    174185{
     
    290301}
    291302
    292 
     303/**
     304   \brief ticks the Text
     305   \param dt the time passed
     306*/
    293307void GraphicsEngine::tick(float dt)
    294308{
    295         if( unlikely(this->bDisplayFPS))
    296         {
    297           this->currentFPS = 1.0/dt;
     309  if( unlikely(this->bDisplayFPS))
     310    {
     311      this->currentFPS = 1.0/dt;
    298312      if( unlikely(this->currentFPS > this->maxFPS)) this->maxFPS = this->currentFPS;
    299           if( unlikely(this->currentFPS < this->minFPS)) this->minFPS = this->currentFPS;
    300          
    301           char tmpChar1[20];
    302           sprintf(tmpChar1, "Current:  %4.0f", this->currentFPS);
    303           this->geTextCFPS->setText(tmpChar1);
    304           char tmpChar2[20];
    305           sprintf(tmpChar2, "Max:    %4.0f", this->maxFPS);
    306           this->geTextMaxFPS->setText(tmpChar2);
    307           char tmpChar3[20];
    308           sprintf(tmpChar3, "Min:    %4.0f", this->minFPS);
    309           this->geTextMinFPS->setText(tmpChar3);
    310         }
    311 }
    312  
     313      if( unlikely(this->currentFPS < this->minFPS)) this->minFPS = this->currentFPS;
     314     
     315      char tmpChar1[20];
     316      sprintf(tmpChar1, "Current:  %4.0f", this->currentFPS);
     317      this->geTextCFPS->setText(tmpChar1);
     318      char tmpChar2[20];
     319      sprintf(tmpChar2, "Max:    %4.0f", this->maxFPS);
     320      this->geTextMaxFPS->setText(tmpChar2);
     321      char tmpChar3[20];
     322      sprintf(tmpChar3, "Min:    %4.0f", this->minFPS);
     323      this->geTextMinFPS->setText(tmpChar3);
     324    }
     325}
     326 
     327/**
     328   \brief displays the Frames per second
     329   \param display if the text should be displayed
     330
     331   \todo this is dangerous
     332*/
    313333void GraphicsEngine::displayFPS(bool display)
    314334{
    315         if( display)
    316         {
    317                 this->geTextCFPS = TextEngine::getInstance()->createText("fonts/druid.ttf", 35, TEXT_DYNAMIC, 0, 255, 0);
    318                 this->geTextCFPS->setAlignment(TEXT_ALIGN_LEFT);
    319                 this->geTextCFPS->setPosition(5, 500);
    320                 this->geTextMaxFPS = TextEngine::getInstance()->createText("fonts/druid.ttf", 35, TEXT_DYNAMIC, 0, 255, 0);
    321                 this->geTextMaxFPS->setAlignment(TEXT_ALIGN_LEFT);
    322                 this->geTextMaxFPS->setPosition(5, 530);
    323                 this->geTextMinFPS = TextEngine::getInstance()->createText("fonts/druid.ttf", 35, TEXT_DYNAMIC, 0, 255, 0);
    324                 this->geTextMinFPS->setAlignment(TEXT_ALIGN_LEFT);
    325                 this->geTextMinFPS->setPosition(5, 560);       
    326         }
    327         this->bDisplayFPS = display;
    328 }
    329 
    330  
     335  if( display)
     336    {
     337      this->geTextCFPS = TextEngine::getInstance()->createText("fonts/druid.ttf", 35, TEXT_DYNAMIC, 0, 255, 0);
     338      this->geTextCFPS->setAlignment(TEXT_ALIGN_LEFT);
     339      this->geTextCFPS->setPosition(5, 500);
     340      this->geTextMaxFPS = TextEngine::getInstance()->createText("fonts/druid.ttf", 35, TEXT_DYNAMIC, 0, 255, 0);
     341      this->geTextMaxFPS->setAlignment(TEXT_ALIGN_LEFT);
     342      this->geTextMaxFPS->setPosition(5, 530);
     343      this->geTextMinFPS = TextEngine::getInstance()->createText("fonts/druid.ttf", 35, TEXT_DYNAMIC, 0, 255, 0);
     344      this->geTextMinFPS->setAlignment(TEXT_ALIGN_LEFT);
     345      this->geTextMinFPS->setPosition(5, 560); 
     346    }
     347  this->bDisplayFPS = display;
     348}
     349
     350 
Note: See TracChangeset for help on using the changeset viewer.