Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8518 in orxonox.OLD for trunk/src/util/hud.cc


Ignore:
Timestamp:
Jun 16, 2006, 10:23:05 AM (18 years ago)
Author:
bensch
Message:

merged the gui back to the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/hud.cc

    r8448 r8518  
    2323#include "glgui_widget.h"
    2424
     25#include "glgui_inputline.h"
     26#include "specials/glgui_notifier.h"
     27
    2528/**
    2629 * standard constructor
     
    3942  this->resY = 1;
    4043
     44  this->inputLine = new OrxGui::GLGuiInputLine();
     45  this->inputLine->setParent2D(this);
     46  this->notifier = new OrxGui::GLGuiNotifier();
     47  this->notifier->setParent2D(this);
     48  notifier->setAbsCoor2D(100,100);
     49
     50
     51
    4152}
    4253
     
    4758Hud::~Hud ()
    4859{
     60  delete this->inputLine;
     61  delete this->notifier;
    4962  // delete what has to be deleted here
    5063}
     
    5669}
    5770
     71void Hud::notifyUser(const std::string& message)
     72{
     73  this->notifier->pushNotifyMessage(message);
     74}
     75
    5876void Hud::setBackGround()
    59 {
    60 }
     77{}
    6178
    6279void Hud::setEnergyWidget(OrxGui::GLGuiWidget* widget)
     
    7491    this->energyWidget->backMaterial().setDiffuseMap("hud_energy_background.png");
    7592    this->energyWidget->backMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    76 /*    this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
    77     this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
     93    /*    this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
     94        this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
    7895  }
    7996
     
    8299
    83100void Hud::setShiledWidget(OrxGui::GLGuiWidget* widget)
    84 {
    85 }
     101{}
    86102
    87103void Hud::setArmorWidget(OrxGui::GLGuiWidget* widget)
    88 {
    89 }
     104{}
    90105
    91106void Hud::setWeaponManager(WeaponManager* weaponMan)
     
    123138  if (this->weaponManager != NULL)
    124139    for (unsigned int i = 0; i < this->weaponManager->getSlotCount(); i++)
    125   {
    126     Weapon* weapon = this->weaponManager->getWeapon(i);
    127     if (weapon != NULL)
    128140    {
    129       weapon->getEnergyWidget()->show();
    130       weapon->getEnergyWidget()->backMaterial().setDiffuse( .8,.2,.11);
    131       weapon->getEnergyWidget()->backMaterial().setTransparency(.1);
    132       weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6));
    133 //      weapon->getEnergyWidget()->frontMaterial().setTransparency(.6);
    134       this->weaponsWidgets.push_back(weapon->getEnergyWidget());
     141      Weapon* weapon = this->weaponManager->getWeapon(i);
     142      if (weapon != NULL)
     143      {
     144        weapon->getEnergyWidget()->show();
     145        weapon->getEnergyWidget()->backMaterial().setDiffuse( .8,.2,.11);
     146        weapon->getEnergyWidget()->backMaterial().setTransparency(.1);
     147        weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6));
     148        //      weapon->getEnergyWidget()->frontMaterial().setTransparency(.6);
     149        this->weaponsWidgets.push_back(weapon->getEnergyWidget());
     150      }
    135151    }
    136   }
    137152  this->updateResolution();
    138153}
    139154
    140155void Hud::addWeaponWidget(OrxGui::GLGuiWidget* widget)
    141 {
    142 }
     156{}
    143157
    144158void Hud::removeWeaponWidget(OrxGui::GLGuiWidget* widget)
    145 {
    146 }
     159{}
    147160
    148161void Hud::updateResolution()
     
    162175  for (weaponWidget = this->weaponsWidgets.begin(); weaponWidget != this->weaponsWidgets.end(); weaponWidget++, pos+=.03)
    163176  {
    164       (*weaponWidget)->setSize2D(.02*this->resX, .2 *this->resY);
    165       (*weaponWidget)->setAbsCoor2D(pos*this->resX, .75*this->resY);
     177    (*weaponWidget)->setSize2D(.02*this->resX, .2 *this->resY);
     178    (*weaponWidget)->setAbsCoor2D(pos*this->resX, .75*this->resY);
    166179
    167180  }
     
    171184void Hud::tick(float dt)
    172185{
    173   if (this->resY != State::getResY() || this->resX != State::getResY())
     186  if (this->resY != State::getResY() || this->resX != State::getResX())
     187  {
    174188    this->updateResolution();
     189  }
     190
    175191}
    176192
    177193void Hud::draw() const
    178194{
    179 //  GLGuiWidget::draw();
     195  //  GLGuiWidget::draw();
    180196}
    181197
Note: See TracChangeset for help on using the changeset viewer.