Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10748 in orxonox.OLD for branches/presentation/src/util


Ignore:
Timestamp:
Jun 20, 2007, 10:11:59 PM (18 years ago)
Author:
bknecht
Message:

fixed stupid gui segfault

Location:
branches/presentation/src/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/util/hud.cc

    r10744 r10748  
    5858  this->resX = 1;
    5959  this->resY = 1;
     60  this->leftHit = NULL;
     61  this->rightHit = NULL;
     62  this->ifinit = true;
    6063
    6164        this->init();
     
    7275  delete this->inputLine;
    7376  delete this->notifier;
    74   delete this->leftHit;
    75   delete this->rightHit;
     77  //delete this->leftHit;
     78  //delete this->rightHit;
    7679
    7780  delete this->_radar;
     
    133136                this->leftHit->loadImageFromFile("textures/gui/gui_hitbar.png");
    134137                this->leftHit->setParent2D(this->middleRect);
    135                 this->leftHit->shiftDir2D(0.5);
     138               
    136139               
    137140                this->rightHit = new OrxGui::GLGuiImage();
     
    438441        this->leftHit->show();
    439442        this->rightHit->show();
     443        hitBarCount = 0.33;
     444}
     445
     446void Hud::tick(float dt)
     447{
     448
     449  if (this->playmode == FirstPerson && this->leftHit != NULL)
     450  {
     451        if (this->ifinit)
     452        {
     453                this->leftHit->shiftDir2D(3.1416);
     454                this->ifinit = false;
     455        }
     456        if (this->leftHit->isVisible())
     457                hitBarCount -= dt;
     458        if (hitBarCount < 0)
     459        {
     460                hitBarCount = 0;
     461                this->leftHit->hide();
     462                this->rightHit->hide();
     463        }
     464  }
    440465}
    441466
     
    502527        this->leftHit->setRelCoor2D(0, 0);
    503528        this->leftHit->setWidgetSize(this->resX/9, this->resX/3);
    504         this->leftHit->show();
     529        this->leftHit->hide();
    505530        this->rightHit->setRelCoor2D(this->resX/3, 0);
    506531        this->rightHit->setWidgetSize(this->resX/9, this->resX/3);
     
    509534        this->barSocket->setWidgetSize(overlayWidth, overlayWidth);
    510535        this->barSocket->setRelCoor2D(this->resX - overlayWidth, 0);
    511         this->barSocket->hide();
     536        this->barSocket->show();
    512537
    513538        //this->middleRect->show();
  • branches/presentation/src/util/hud.h

    r10744 r10748  
    5252  void getHit();
    5353
     54  void tick(float dt);
     55
    5456  void setBackGround();
    5557  void setEnergyWidget(OrxGui::GLGuiWidget* widget);
     
    101103  unsigned int             resX;
    102104  unsigned int             resY;
     105
     106  float                 hitBarCount;
    103107 
    104108  Hud::Playmode                         playmode;
     
    115119  OrxGui::GLGuiRadar*      _radar;
    116120  PNode*                   radarCenterNode;
     121
     122  bool                  ifinit;
    117123
    118124  OrxGui::GLGuiWidget*     rightRect;
Note: See TracChangeset for help on using the changeset viewer.