Changeset 6442 in orxonox.OLD for trunk/src/util
- Timestamp:
- Jan 8, 2006, 5:19:39 PM (19 years ago)
- Location:
- trunk/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/hud.cc
r6441 r6442 20 20 #include "state.h" 21 21 22 #include "world_entities/weapons/weapon_manager.h" 23 22 24 using namespace std; 23 25 … … 32 34 33 35 //this->setSize2D( 36 this->weaponManager = NULL; 34 37 this->energyWidget = NULL; 35 38 this->shieldWidget = NULL; … … 37 40 this->resX = 1; 38 41 this->resY = 1; 42 39 43 } 40 44 … … 51 55 void Hud::loadParams(const TiXmlElement* root) 52 56 { 53 54 57 } 55 58 56 59 void Hud::setBackGround() 57 60 { 58 59 61 } 60 62 … … 78 80 void Hud::setShiledWidget(GLGuiWidget* widget) 79 81 { 80 81 82 } 82 83 83 84 void Hud::setArmorWidget(GLGuiWidget* widget) 84 85 { 86 } 85 87 88 void Hud::setWeaponManager(WeaponManager* weaponMan) 89 { 90 if (this->weaponManager != NULL) 91 { 92 for (unsigned int i = 0; i < this->weaponManager->getSlotCount(); i++) 93 { 94 Weapon* weapon = this->weaponManager->getWeapon(i); 95 if (weapon != NULL) 96 { 97 weapon->getEnergyWidget()->hide(); 98 this->weaponsWidgets.remove(weapon->getEnergyWidget()); 99 } 100 } 101 } 102 103 this->weaponManager = weaponMan; 104 105 if (weaponManager != NULL) 106 for (unsigned int i = 0; i < weaponMan->getSlotCount(); i++) 107 { 108 Weapon* weapon = weaponMan->getWeapon(i); 109 if (weapon != NULL) 110 { 111 weapon->getEnergyWidget()->show(); 112 this->weaponsWidgets.push_back(weapon->getEnergyWidget()); 113 114 } 115 } 116 117 this->updateResolution(); 86 118 } 119 87 120 88 121 void Hud::addWeaponWidget(GLGuiWidget* widget) 89 122 { 90 91 123 } 92 124 93 125 void Hud::removeWeaponWidget(GLGuiWidget* widget) 94 126 { 95 96 127 } 97 128 … … 105 136 this->energyWidget->setSize2D(.05 * this->resX, .55 * this->resY); 106 137 } 138 139 this->setSize2D(.2 * this->resX, this->resY); 140 141 std::list<GLGuiWidget*>::iterator weaponWidget; 142 float pos = .2; 143 for (weaponWidget = this->weaponsWidgets.begin(); weaponWidget != this->weaponsWidgets.end(); weaponWidget++, pos+=.03) 144 { 145 (*weaponWidget)->setSize2D(.02*this->resX, .2 *this->resY); 146 (*weaponWidget)->setAbsCoor2D(pos*this->resX, .75*this->resY); 147 } 148 107 149 } 108 150 -
trunk/src/util/hud.h
r6441 r6442 12 12 // FORWARD DECLARATION 13 13 class TiXmlElement; 14 14 class WeaponManager; 15 15 16 16 //! A class that renders a HUD. … … 29 29 void setShiledWidget(GLGuiWidget* widget); 30 30 void setArmorWidget(GLGuiWidget* widget); 31 void setWeaponManager(WeaponManager* weaponMan); 31 32 32 33 void addWeaponWidget(GLGuiWidget* widget); … … 46 47 GLGuiWidget* armorWidget; 47 48 49 WeaponManager* weaponManager; 50 48 51 std::list<GLGuiWidget*> weaponsWidgets; //!< WeaponWidgets will be displayed one after another 49 52 };
Note: See TracChangeset
for help on using the changeset viewer.