Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10748 in orxonox.OLD for branches


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

fixed stupid gui segfault

Location:
branches/presentation/src
Files:
4 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;
  • branches/presentation/src/world_entities/creatures/fps_player.cc

    r10744 r10748  
    328328  }
    329329 
    330   /*
     330 
    331331  if( this->bFire2 )
    332332  {
     
    353353  {
    354354      this->changeZoom = true;
    355   }*/
    356   if( this->bFire2 )
     355  }
     356  /*if( this->bFire2 )
    357357  {
    358358      if( this->changeZoom )
     
    378378      this->changeZoom = true;
    379379      this->changingZoom = false;
    380   }
    381 
    382   this->getWeaponManager().tick(time);
     380  }*/
     381
     382  /*this->getWeaponManager().tick(time);
    383383  if( this->bFire)
    384384  {
    385385    this->getWeaponManager().fire();
    386   }
     386  }*/
     387  Playable::tick(time);
    387388
    388389
     
    448449  else
    449450      speed = 100;
     451
     452  velocity.normalize();
    450453  velocity *= speed;
    451454
  • branches/presentation/src/world_entities/playable.cc

    r10618 r10748  
    451451  if (this->bFire)
    452452    weaponMan.fire();
     453
     454  if (currentPlayer != NULL)
     455        currentPlayer->hud().tick(dt);
    453456}
    454457
Note: See TracChangeset for help on using the changeset viewer.