Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jan 10, 2007, 7:16:00 PM (18 years ago)
Author:
muellmic
Message:

interface changes

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

Legend:

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

    r10194 r10230  
    2424#include "glgui_widget.h"
    2525#include "glgui_box.h"
     26#include "glgui_bar.h"
    2627#include "elements/glgui_energywidgetvertical.h"
    2728
     
    5152  this->shieldWidget = NULL;
    5253  this->armorWidget = NULL;
     54  //this->leftRect = NULL;
     55  //this->rightRect = NULL;
    5356  this->resX = 1;
    5457  this->resY = 1;
     58
     59  this->travelZoneWidth = 0.7;
    5560
    5661  this->inputLine = new OrxGui::GLGuiInputLine();
     
    115120    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setDisplayedName("Electronics");
    116121    //this->shipValuesBox->pack(this->energyWidget);
     122    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setStandardSettings();
    117123    this->energyWidget->show();
    118124    /*    this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
     
    141147    //this->shieldWidget->shiftDir2D(270);
    142148    //this->shipValuesBox->pack(this->shieldWidget);
     149    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->shieldWidget)->setStandardSettings();
    143150    this->shieldWidget->show();
    144151    /*    this->shieldWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
     
    169176    //this->armorWidget->shiftDir2D(270);
    170177    //this->shipValuesBox->pack(this->armorWidget);
     178    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->armorWidget)->setStandardSettings();
    171179    this->armorWidget->show();
    172180    /*    this->armorWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
     
    187195      {
    188196        weapon->getEnergyWidget()->hide();
    189         this->weaponsWidgets.remove(weapon->getEnergyWidget());
     197        this->weaponsWidgetsPrim.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));
    190198      }
    191199    }
     
    200208      {
    201209        weapon->getEnergyWidget()->hide();
    202         this->weaponsWidgets.remove(weapon->getEnergyWidget());
     210        this->weaponsWidgetsSec.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));
    203211      }
    204212    }
     
    215223{
    216224  // hide all the Widgets
    217   std::list<OrxGui::GLGuiWidget*>::iterator weaponWidget;
    218   for (weaponWidget = this->weaponsWidgets.begin(); weaponWidget != this->weaponsWidgets.end(); weaponWidget++)
     225  std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget;
     226  for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++)
    219227  {
    220228    (*weaponWidget)->hide();
    221229  }
    222   this->weaponsWidgets.clear();
     230  this->weaponsWidgetsPrim.clear();
     231
     232  for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++)
     233  {
     234    (*weaponWidget)->hide();
     235  }
     236  this->weaponsWidgetsSec.clear();
    223237
    224238  // add all that we need again.
     
    234248        weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6));
    235249        //weapon->getEnergyWidget()->frontMaterial().setTransparency(.6);
    236         this->weaponsWidgets.push_back(weapon->getEnergyWidget());
     250        this->weaponsWidgetsPrim.push_back(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));
    237251      }
    238252    }
     
    249263        weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6));
    250264        //weapon->getEnergyWidget()->frontMaterial().setTransparency(.6);
    251         this->weaponsWidgets.push_back(weapon->getEnergyWidget());
     265        this->weaponsWidgetsSec.push_back(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));
    252266      }
    253267    }
     
    280294    this->_radar->addEntityList(&State::getObjectManager()->getEntityList(OM_GROUP_00), Color(1, 0, 0));
    281295    this->_radar->addEntityList(&State::getObjectManager()->getEntityList(OM_GROUP_01), Color(0, 0, 1));
    282     this->_radar->setAbsCoor2D(0.8 * this->resX, 0.01 * this->resY);
    283     this->_radar->setWidgetSize(0.2 * this->resX, 0.2 * this->resY);
     296    this->_radar->setAbsCoor2D(0, 0.01 * this->resY);
     297    this->_radar->setWidgetSize(0.18 * this->resX, 0.2 * this->resY);
    284298    this->_radar->setRange(300);
    285299    this->_radar->show();
    286300
    287301    if (this->armorWidget != NULL)
    288       this->armorWidget->setRelCoor2D(0.1*this->resX, this->armorWidget->getSizeX2D());
     302      this->armorWidget->setRelCoor2D(100,0.2*this->resY + this->armorWidget->getSizeX2D());
    289303    if (this->shieldWidget != NULL)
    290       this->shieldWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeY2D(), this->armorWidget->getSizeX2D());
     304      this->shieldWidget->setRelCoor2D(60,0.2*this->resY + this->armorWidget->getSizeX2D());
    291305    if (this->energyWidget != NULL)
    292       this->energyWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeY2D() + this->shieldWidget->getSizeY2D(), this->armorWidget->getSizeX2D());
     306      this->energyWidget->setRelCoor2D(20,0.2*this->resY + this->armorWidget->getSizeX2D());
    293307    //this->shieldWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeX2D(),0);
    294308    //this->energyWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeX2D() + this->shieldWidget->getSizeX2D(),0);
     
    305319  */
    306320
    307   std::list<OrxGui::GLGuiWidget*>::iterator weaponWidget;
    308   Vector2D pos(0.3, .9);
    309   for (weaponWidget = this->weaponsWidgets.begin(); weaponWidget != this->weaponsWidgets.end(); weaponWidget++, pos.x+=.1)
    310   {
    311     if (pos.x > .8)
    312     {
    313       pos.x = 0.3;
    314       pos.y -= .1;
    315 
    316     }
    317     (*weaponWidget)->setAbsCoor2D(pos.x*this->resX, pos.y*this->resY);
    318     (*weaponWidget)->setWidgetSize(.02*this->resX, .1 *this->resY);
     321  std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget;
     322  Vector2D pos(this->resX, 0.5*this->resY);
     323  for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++)
     324  {
     325    if (pos.x < 0.9*resX)
     326    {
     327      pos.x = this->resX;
     328      pos.y += 150;
     329    }
     330    pos.x -= 40;
     331    (*weaponWidget)->setAbsCoor2D(pos.x, pos.y);
    319332    (*weaponWidget)->show();
    320333    //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName());
    321334  }
     335
     336  pos.y += 150;
     337  pos.x = this->resX;
     338  for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++)
     339  {
     340    if (pos.x < 0.9*resX)
     341    {
     342      pos.x = this->resX;
     343      pos.y += 150;
     344    }
     345    pos.x -= 40;
     346    (*weaponWidget)->setAbsCoor2D(pos.x, pos.y);
     347    (*weaponWidget)->show();
     348    //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName());
     349  }
     350
     351  //if (this->rightRect == NULL)
     352         
    322353}
    323354
  • branches/playability/src/util/hud.h

    r10194 r10230  
    1010#include "event_listener.h"
    1111#include "glgui_box.h"
     12#include "elements/glgui_energywidgetvertical.h"
    1213
    1314
     
    5354  void updateWeaponManager();
    5455
     56  inline void setTravelZoneWidth(float width)
     57  {
     58    if (width > 1) width = 1;
     59    else if (width < 0) width = 0;
     60
     61    this->travelZoneWidth = width;
     62  };
     63
    5564  void draw() const;
    5665  virtual void process(const Event &event);
     
    6574  unsigned int             resY;
    6675
     76  float                    travelZoneWidth; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1;
     77
    6778  OrxGui::GLGuiWidget*     energyWidget;
    6879  OrxGui::GLGuiWidget*     shieldWidget;
    6980  OrxGui::GLGuiWidget*     armorWidget;
    70   //OrxGui::GLGuiBox*        shipValuesBox;
    7181
    7282  OrxGui::GLGuiNotifier*   notifier;
     
    7484  OrxGui::GLGuiRadar*      _radar;
    7585
     86  OrxGui::GLGuiWidget*     rightRect, leftRect;
     87
    7688  WeaponManager*           weaponManager;
    7789  WeaponManager*           weaponManagerSecondary;
    7890
    79   std::list<OrxGui::GLGuiWidget*> weaponsWidgets; //!< WeaponWidgets will be displayed one after another
     91  std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsPrim; //!< WeaponWidgets will be displayed one after another
     92  std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsSec;
    8093};
    8194
Note: See TracChangeset for help on using the changeset viewer.