Changeset 8518 in orxonox.OLD for trunk/src/util
- Timestamp:
- Jun 16, 2006, 10:23:05 AM (19 years ago)
- Location:
- trunk/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/hud.cc
r8448 r8518 23 23 #include "glgui_widget.h" 24 24 25 #include "glgui_inputline.h" 26 #include "specials/glgui_notifier.h" 27 25 28 /** 26 29 * standard constructor … … 39 42 this->resY = 1; 40 43 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 41 52 } 42 53 … … 47 58 Hud::~Hud () 48 59 { 60 delete this->inputLine; 61 delete this->notifier; 49 62 // delete what has to be deleted here 50 63 } … … 56 69 } 57 70 71 void Hud::notifyUser(const std::string& message) 72 { 73 this->notifier->pushNotifyMessage(message); 74 } 75 58 76 void Hud::setBackGround() 59 { 60 } 77 {} 61 78 62 79 void Hud::setEnergyWidget(OrxGui::GLGuiWidget* widget) … … 74 91 this->energyWidget->backMaterial().setDiffuseMap("hud_energy_background.png"); 75 92 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);*/ 78 95 } 79 96 … … 82 99 83 100 void Hud::setShiledWidget(OrxGui::GLGuiWidget* widget) 84 { 85 } 101 {} 86 102 87 103 void Hud::setArmorWidget(OrxGui::GLGuiWidget* widget) 88 { 89 } 104 {} 90 105 91 106 void Hud::setWeaponManager(WeaponManager* weaponMan) … … 123 138 if (this->weaponManager != NULL) 124 139 for (unsigned int i = 0; i < this->weaponManager->getSlotCount(); i++) 125 {126 Weapon* weapon = this->weaponManager->getWeapon(i);127 if (weapon != NULL)128 140 { 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 } 135 151 } 136 }137 152 this->updateResolution(); 138 153 } 139 154 140 155 void Hud::addWeaponWidget(OrxGui::GLGuiWidget* widget) 141 { 142 } 156 {} 143 157 144 158 void Hud::removeWeaponWidget(OrxGui::GLGuiWidget* widget) 145 { 146 } 159 {} 147 160 148 161 void Hud::updateResolution() … … 162 175 for (weaponWidget = this->weaponsWidgets.begin(); weaponWidget != this->weaponsWidgets.end(); weaponWidget++, pos+=.03) 163 176 { 164 165 177 (*weaponWidget)->setSize2D(.02*this->resX, .2 *this->resY); 178 (*weaponWidget)->setAbsCoor2D(pos*this->resX, .75*this->resY); 166 179 167 180 } … … 171 184 void Hud::tick(float dt) 172 185 { 173 if (this->resY != State::getResY() || this->resX != State::getResY()) 186 if (this->resY != State::getResY() || this->resX != State::getResX()) 187 { 174 188 this->updateResolution(); 189 } 190 175 191 } 176 192 177 193 void Hud::draw() const 178 194 { 179 // GLGuiWidget::draw();195 // GLGuiWidget::draw(); 180 196 } 181 197 -
trunk/src/util/hud.h
r8448 r8518 10 10 // FORWARD DECLARATION 11 11 class TiXmlElement; 12 12 13 class WeaponManager; 13 namespace OrxGui { class GLGuiWidget; } 14 namespace OrxGui { 15 class GLGuiWidget; 16 class GLGuiNotifier; 17 class GLGuiInputLine; 18 19 } 14 20 15 21 //! A class that renders a HUD. … … 23 29 24 30 virtual void loadParams(const TiXmlElement* root); 31 32 void notifyUser(const std::string& message); 33 25 34 26 35 void setBackGround(); … … 49 58 OrxGui::GLGuiWidget* armorWidget; 50 59 60 OrxGui::GLGuiNotifier* notifier; 61 OrxGui::GLGuiInputLine* inputLine; 62 51 63 WeaponManager* weaponManager; 52 64
Note: See TracChangeset
for help on using the changeset viewer.