Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jan 12, 2007, 11:24:37 PM (17 years ago)
Author:
muellmic
Message:

several interface changes and workarounds later… (yes there that crappy little flower at the op-left edge says hello again..)

File:
1 edited

Legend:

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

    r10233 r10234  
    5757  this->resY = 1;
    5858
    59   this->overlayPercentage = 5;
     59  this->overlayPercentage = 40;
    6060  this->overlayActive = false;
    61   this->rightRect = NULL;
    62   this->leftRect = NULL;
     61  this->rightRect = new OrxGui::GLGuiImage();
     62  this->leftRect = new OrxGui::GLGuiImage();
    6363
    6464  this->inputLine = new OrxGui::GLGuiInputLine();
     
    126126    //this->shipValuesBox->pack(this->energyWidget);
    127127    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setStandardSettings();
     128    this->energyWidget->setParent2D(this->leftRect);
    128129    this->energyWidget->show();
    129130    /*    this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
     
    153154    //this->shipValuesBox->pack(this->shieldWidget);
    154155    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->shieldWidget)->setStandardSettings();
     156    this->shieldWidget->setParent2D(this->leftRect);
    155157    this->shieldWidget->show();
    156158    /*    this->shieldWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
     
    182184    //this->shipValuesBox->pack(this->armorWidget);
    183185    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->armorWidget)->setStandardSettings();
     186    this->armorWidget->setParent2D(this->leftRect);
    184187    this->armorWidget->show();
    185188    /*    this->armorWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
     
    249252      {
    250253        //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassCName(), weapon->getName());
     254        weapon->getEnergyWidget()->setParent2D(this->rightRect);
    251255        weapon->getEnergyWidget()->show();
    252256        weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1));
    253257        weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6));
     258        weapon->getEnergyWidget()->setWidgetSize(120,30);
    254259        //weapon->getEnergyWidget()->frontMaterial().setTransparency(.6);
    255260        this->weaponsWidgetsPrim.push_back(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));
     
    264269      {
    265270        //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassCName(), weapon->getName());
     271        weapon->getEnergyWidget()->setParent2D(this->rightRect);
    266272        weapon->getEnergyWidget()->show();
    267273        weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1));
     
    291297  this->notifier->setWidgetSize(0.25 * this->resX, 0.6 * this->resY);
    292298
     299  int overlayWidth = this->resX * (overlayPercentage)/(200);
     300  this->rightRect->hide();
     301  this->leftRect->hide();
     302
     303  this->leftRect->setParent2D(this);
     304  this->leftRect->setWidgetSize(float(overlayWidth), float(this->resY));
     305  this->leftRect->setAbsCoor2D(0,0);
     306  this->leftRect->setBackgroundTexture(Texture());
     307  this->leftRect->setBackgroundColor(Color(0,0,0.7,0.2));
     308  this->leftRect->setForegroundTexture(Texture());
     309  this->leftRect->setForegroundColor(Color(0,0,0,0));
     310
     311  this->rightRect->setParent2D(this);
     312  this->rightRect->setWidgetSize(float(overlayWidth), float(this->resY));
     313  this->rightRect->setAbsCoor2D(this->resX - overlayWidth,0);
     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(0,0,0,0));
     318
     319
    293320  if (this->overlayActive == true)
    294321  {
    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));
     322    this->rightRect->show();
    307323    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    
    320324  }
    321325
     
    324328  {
    325329    PRINTF(4)("UPDATING RADAR\n");
     330    this->_radar->setParent2D(this->leftRect);
    326331    this->_radar->setCenterNode(State::getPlayer()->getPlayable());
    327332    //this->_radar->addEntityList(&State::getObjectManager()->getEntityList((OM_LIST)(State::getPlayer()->getPlayable()->getOMListNumber()+1)), Color(.4, .4, 1.0));
     
    354359
    355360  std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget;
    356   Vector2D pos(this->resX, 0.5*this->resY);
     361  Vector2D pos(overlayWidth, 0.5*this->resY);
     362
     363  // out of reasons i can't get behind, this version is segfaulting when calling getSizeX2D or getSizeY2D. the other
     364  // element2D- related function works tough.. :s
     365
    357366  for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++)
    358367  {
    359     if (pos.x < 0.9*resX)
    360     {
    361       pos.x = this->resX;
    362       pos.y += 150;
    363     }
    364     pos.x -= 40;
     368    if (pos.x < overlayWidth*0.2)
     369    {
     370      pos.x = overlayWidth;
     371      pos.y += (*weaponWidget)->getSizeX2D();
     372    }
     373    pos.x -= (*weaponWidget)->getSizeY2D();
    365374    (*weaponWidget)->setAbsCoor2D(pos.x, pos.y);
     375    //(*weaponWidget)->setAbsCoor2D(0,100);
    366376    (*weaponWidget)->show();
    367377    //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName());
    368378  }
    369379
    370   pos.y += 150;
    371   pos.x = this->resX;
     380  pos.y += 160;
     381  pos.x = overlayWidth;
    372382  for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++)
    373383  {
    374     if (pos.x < 0.9*resX)
    375     {
    376       pos.x = this->resX;
    377       pos.y += 150;
    378     }
    379     pos.x -= 40;
     384    if (pos.x < overlayWidth*0.2)
     385    {
     386      pos.x = overlayWidth;
     387      pos.y += (*weaponWidget)->getSizeX2D();
     388    }
     389    pos.x -= (*weaponWidget)->getSizeY2D();
    380390    (*weaponWidget)->setAbsCoor2D(pos.x, pos.y);
    381391    (*weaponWidget)->show();
Note: See TracChangeset for help on using the changeset viewer.