Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4849 in orxonox.OLD for orxonox/trunk/src/lib/graphics


Ignore:
Timestamp:
Jul 13, 2005, 7:03:05 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: the crosshair now renders as element2d

Location:
orxonox/trunk/src/lib/graphics
Files:
5 edited

Legend:

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

    r4838 r4849  
    2020#include "event_handler.h"
    2121
     22#include "render_2d.h"
    2223#include "debug.h"
    2324#include "text_engine.h"
     
    5859{
    5960  // delete what has to be deleted here
     61
     62  delete Render2D::getInstance();
     63  GraphicsEngine::singletonRef = NULL;
    6064}
    6165
     
    148152  glEnable(GL_DEPTH_TEST);
    149153
    150 
    151   // subscribe the resolutionChanged-event
    152   //EventHandler::getInstance()->subscribe(this, ES_GAME, EV_VIDEO_RESIZE);
    153   //! @todo eventSystem craps up the Starting of orxonox -> see why.
     154  Render2D::getInstance();
    154155
    155156  this->isInit = true;
     
    402403 * @param dt the time passed
    403404*/
    404 void GraphicsEngine::tick(float dt)
     405  void GraphicsEngine::tick(float dt)
    405406{
    406407  if( unlikely(this->bDisplayFPS))
    407     {
    408       this->currentFPS = 1.0/dt;
    409       if( unlikely(this->currentFPS > this->maxFPS)) this->maxFPS = this->currentFPS;
    410       if( unlikely(this->currentFPS < this->minFPS)) this->minFPS = this->currentFPS;
     408  {
     409    this->currentFPS = 1.0/dt;
     410    if( unlikely(this->currentFPS > this->maxFPS)) this->maxFPS = this->currentFPS;
     411    if( unlikely(this->currentFPS < this->minFPS)) this->minFPS = this->currentFPS;
    411412
    412413#ifndef NO_TEXT
     
    421422      this->geTextMinFPS->setText(tmpChar3);
    422423#endif /* NO_TEXT */
    423     }
     424
     425
     426  }
     427  Render2D::getInstance()->tick(dt);
     428
     429}
     430
     431
     432void GraphicsEngine::draw() const
     433{
     434  Render2D::getInstance()->draw();
     435
    424436}
    425437
  • orxonox/trunk/src/lib/graphics/graphics_engine.h

    r4836 r4849  
    6363
    6464    void tick(float dt);
     65    void draw() const;
    6566    void displayFPS(bool display);
    6667
  • orxonox/trunk/src/lib/graphics/render2D/element_2d.h

    r4848 r4849  
    4343
    4444//! A class for ...
    45 class Element2D : public BaseObject {
     45class Element2D : virtual public BaseObject {
    4646
    4747 public:
  • orxonox/trunk/src/lib/graphics/render2D/render_2d.cc

    r4848 r4849  
    7777
    7878
     79void Render2D::tick(float dt)
     80{
     81  tIterator<Element2D>* iterator = this->element2DList->getIterator();
     82  Element2D* elem = iterator->nextElement();
     83  while (elem != NULL)
     84  {
     85    elem->tick(dt);
     86    elem = iterator->nextElement();
     87  }
     88  delete iterator;
     89
     90}
     91
     92/**
     93 * renders all the Elements of the Render2D-engine
     94 */
    7995void Render2D::draw() const
    8096{
  • orxonox/trunk/src/lib/graphics/render2D/render_2d.h

    r4848 r4849  
    2121  inline static Render2D* getInstance() { if (!singletonRef) singletonRef = new Render2D();  return singletonRef; };
    2222
    23 
     23  void tick(float dt);
    2424  void draw() const;
    2525
Note: See TracChangeset for help on using the changeset viewer.