Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8517 in orxonox.OLD


Ignore:
Timestamp:
Jun 16, 2006, 9:16:50 AM (18 years ago)
Author:
bensch
Message:

notifier now in hud (have to reposition it usefully

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

Legend:

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

    r8448 r8517  
    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
  • branches/gui/src/util/hud.h

    r8448 r8517  
    1010// FORWARD DECLARATION
    1111class TiXmlElement;
     12
    1213class WeaponManager;
    13 namespace OrxGui { class GLGuiWidget; }
     14namespace OrxGui {
     15  class GLGuiWidget;
     16  class GLGuiNotifier;
     17  class GLGuiInputLine;
     18
     19}
    1420
    1521//! A class that renders a HUD.
     
    2329
    2430  virtual void loadParams(const TiXmlElement* root);
     31
     32  void notifyUser(const std::string& message);
     33
    2534
    2635  void setBackGround();
     
    4958  OrxGui::GLGuiWidget*     armorWidget;
    5059
     60  OrxGui::GLGuiNotifier*   notifier;
     61  OrxGui::GLGuiInputLine*  inputLine;
     62
    5163  WeaponManager*           weaponManager;
    5264
Note: See TracChangeset for help on using the changeset viewer.