Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10233 in orxonox.OLD for branches/playability/src/util


Ignore:
Timestamp:
Jan 11, 2007, 11:42:43 PM (18 years ago)
Author:
muellmic
Message:

energy bars are now changing its colors, adding hud overlay - very strange coordinate behaviour tough, awaiting fix

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

Legend:

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

    r10230 r10233  
    5757  this->resY = 1;
    5858
    59   this->travelZoneWidth = 0.7;
     59  this->overlayPercentage = 5;
     60  this->overlayActive = false;
     61  this->rightRect = NULL;
     62  this->leftRect = NULL;
    6063
    6164  this->inputLine = new OrxGui::GLGuiInputLine();
     
    8386
    8487  delete this->_radar;
     88  delete this->rightRect;
     89  delete this->leftRect;
    8590  //if (this->shipValuesBox != NULL)
    8691    //delete this->shipValuesBox;
     
    286291  this->notifier->setWidgetSize(0.25 * this->resX, 0.6 * this->resY);
    287292
     293  if (this->overlayActive == true)
     294  {
     295    if (this->rightRect == NULL)
     296      this->rightRect = new OrxGui::GLGuiWidget();
     297    //if (this->leftRect == NULL)
     298      //this->leftRect = new OrxGui::GLGuiWidget();
     299   
     300    int overlayWidth = this->resX * (100-overlayPercentage)/(200);
     301    this->rightRect->hide();
     302    /*
     303    this->leftRect->setWidgetSize(float(overlayWidth), float(this->resY));
     304    this->leftRect->setAbsCoor2D(0,0);
     305    this->leftRect->setBackgroundTexture(Texture());
     306    this->leftRect->setBackgroundColor(Color(0,0,0.7,0.2));
     307    this->leftRect->show();
     308    */
     309   
     310   
     311    this->rightRect->setParent2D(this);
     312    this->rightRect->setWidgetSize(float(overlayWidth), float(this->resY));
     313    this->rightRect->setAbsCoor2D(this->resX - overlayWidth,this->resY);
     314    this->rightRect->setBackgroundTexture(Texture());
     315    this->rightRect->setBackgroundColor(Color(0,0,0.7,0.2));
     316    //this->rightRect->setForegroundTexture(Texture());
     317    //this->rightRect->setForegroundColor(Color(1,1,1,1));
     318    this->rightRect->show();
     319   
     320  }
     321
    288322
    289323  if (State::getPlayer() && State::getPlayer()->getPlayable() && State::getObjectManager())
     
    349383  }
    350384
    351   //if (this->rightRect == NULL)
    352          
    353385}
    354386
  • branches/playability/src/util/hud.h

    r10230 r10233  
    5454  void updateWeaponManager();
    5555
    56   inline void setTravelZoneWidth(float width)
     56  inline void setOverlayPercentage(int perc)
    5757  {
    58     if (width > 1) width = 1;
    59     else if (width < 0) width = 0;
     58    if (perc > 100) perc = 100;
     59    else if (perc < 0) perc = 0;
    6060
    61     this->travelZoneWidth = width;
     61    this->overlayPercentage = perc;
     62    updateResolution();
     63  };
     64
     65  inline void setOverlayActive(bool b)
     66  {
     67    overlayActive = b;
     68    updateResolution();
    6269  };
    6370
     
    8491  OrxGui::GLGuiRadar*      _radar;
    8592
    86   OrxGui::GLGuiWidget*     rightRect, leftRect;
     93  OrxGui::GLGuiWidget*     rightRect;
     94  OrxGui::GLGuiWidget*     leftRect;
     95  bool                     overlayActive;
     96  int                      overlayPercentage; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1;
    8797
    8898  WeaponManager*           weaponManager;
Note: See TracChangeset for help on using the changeset viewer.