Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8976 in orxonox.OLD for trunk


Ignore:
Timestamp:
Jul 1, 2006, 1:05:38 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: the hud displays Energy and WeaponEnergy

Location:
trunk/src
Files:
4 edited

Legend:

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

    r8975 r8976  
    1919
    2020#include "state.h"
     21#include "debug.h"
    2122
    2223#include "world_entities/weapons/weapon_manager.h"
     
    121122
    122123  this->updateWeaponManager();
    123   this->updateResolution();
     124//  this->updateResolution();
    124125}
    125126
     
    141142      if (weapon != NULL)
    142143      {
     144        //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassName(), weapon->getName());
    143145        weapon->getEnergyWidget()->show();
    144146        weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1));
     
    161163  this->resX = State::getResX();
    162164  this->resY = State::getResY();
     165
     166  this->setSize2D(.2 * this->resX, this->resY);
     167
    163168  if (this->energyWidget != NULL)
    164169  {
     
    167172  }
    168173
    169   this->setSize2D(.2 * this->resX, this->resY);
    170174
    171175  std::list<OrxGui::GLGuiWidget*>::iterator weaponWidget;
    172176  float pos = .3;
    173   for (weaponWidget = this->weaponsWidgets.begin(); weaponWidget != this->weaponsWidgets.end(); weaponWidget++, pos+=.03)
    174   {
    175     (*weaponWidget)->setWidgetSize(.02*this->resX, .2 *this->resY);
    176     (*weaponWidget)->setAbsCoor2D(pos*this->resX, .75*this->resY);
    177 
     177  for (weaponWidget = this->weaponsWidgets.begin(); weaponWidget != this->weaponsWidgets.end(); weaponWidget++, pos+=.3)
     178  {
     179    (*weaponWidget)->setAbsCoor2D(pos*this->resX, .9*this->resY);
     180    (*weaponWidget)->setWidgetSize(.02*this->resX, .1 *this->resY);
     181    (*weaponWidget)->show();
     182    //printf("update thing %s::%s\n", (*weaponWidget)->getClassName(), (*weaponWidget)->getName());
    178183  }
    179184}
  • trunk/src/world_entities/elements/glgui_energywidget.cc

    r8975 r8976  
    5050  void GLGuiEnergyWidget::setValue(float value)
    5151  {
    52     MultiType val = value;
     52    MultiType val(value);
     53    val.setType(MT_INT);
    5354
    5455    this->bar.setValue(value);
  • trunk/src/world_entities/weapons/weapon.cc

    r8316 r8976  
    3434#include "sound_buffer.h"
    3535
    36 #include "glgui_bar.h"
     36#include "elements/glgui_energywidget.h"
    3737
    3838using namespace std;
     
    312312  if (this->energyWidget == NULL)
    313313  {
    314     this->energyWidget = new OrxGui::GLGuiBar;
     314    this->energyWidget = new OrxGui::GLGuiEnergyWidget;
    315315    this->energyWidget->setSize2D( 20, 100);
    316316    this->energyWidget->setMaximum(this->getEnergyMax());
  • trunk/src/world_entities/weapons/weapon.h

    r8777 r8976  
    2525class TiXmlElement;
    2626class FastFactory;
    27 namespace OrxGui{ class GLGuiWidget; }
    2827template<class T> class tFastFactory;
    2928
     
    210209    float                maxCharge;                        //!< The maximal energy to be loaded onto one projectile (this is only availible if chargeable is enabled)
    211210
    212     OrxGui::GLGuiBar*    energyWidget;
     211    OrxGui::GLGuiEnergyWidget* energyWidget;
    213212
    214213    PNode*               defaultTarget;                    //!< A target for targeting Weapons.
Note: See TracChangeset for help on using the changeset viewer.