Changeset 10278 in orxonox.OLD for branches/playability/src/util
- Timestamp:
- Jan 17, 2007, 7:23:47 PM (18 years ago)
- Location:
- branches/playability/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/util/hud.cc
r10270 r10278 197 197 void Hud::setWeaponManager(WeaponManager* weaponMan, WeaponManager* weaponManSec) 198 198 { 199 //clearWeaponManager(); 200 201 //Hide all widgets 199 202 if (this->weaponManager != NULL) 200 203 { … … 205 208 { 206 209 weapon->getEnergyWidget()->hide(); 207 this->weaponsWidgetsPrim.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));210 //this->weaponsWidgetsPrim.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget())); 208 211 } 209 212 } … … 218 221 { 219 222 weapon->getEnergyWidget()->hide(); 220 this->weaponsWidgetsSec.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));223 //this->weaponsWidgetsSec.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget())); 221 224 } 222 225 } … … 224 227 225 228 this->weaponManager = weaponMan; 226 this->weaponManagerSecondary = weaponManSec; 229 this->weaponManagerSecondary = weaponManSec; 227 230 228 231 this->updateWeaponManager(); … … 230 233 } 231 234 235 /* 236 void Hud::clearWeaponManager() 237 { 238 //Hide all widgets 239 if (this->weaponManager != NULL) 240 { 241 for (unsigned int i = 0; i < this->weaponManager->getSlotCount(); i++) 242 { 243 Weapon* weapon = this->weaponManager->getWeapon(i); 244 if (weapon != NULL) 245 { 246 weapon->getEnergyWidget()->hide(); 247 //this->weaponsWidgetsPrim.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget())); 248 } 249 } 250 } 251 252 if (this->weaponManagerSecondary != NULL) 253 { 254 for (unsigned int i = 0; i < this->weaponManagerSecondary->getSlotCount(); i++) 255 { 256 Weapon* weapon = this->weaponManagerSecondary->getWeapon(i); 257 if (weapon != NULL) 258 { 259 weapon->getEnergyWidget()->hide(); 260 //this->weaponsWidgetsSec.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget())); 261 } 262 } 263 } 264 265 //this->weaponsWidgetsPrim.clear(); 266 //this->weaponsWidgetsSec.clear(); 267 } 268 */ 269 232 270 void Hud::updateWeaponManager() 233 271 { 234 272 // hide all the Widgets 273 235 274 std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget; 236 275 for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++) … … 245 284 } 246 285 this->weaponsWidgetsSec.clear(); 286 247 287 248 288 // add all that we need again. 289 249 290 if (this->weaponManager != NULL) 250 291 for (unsigned int i = 0; i < this->weaponManager->getSlotCount(); i++) … … 365 406 366 407 std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget; 367 Vector2D pos (overlayWidth, 0.5*this->resY);368 408 Vector2D pos = Vector2D(overlayWidth + this->rightRect->getAbsCoor2D().x, 0.5*this->resY); 409 PRINTF(0)("Cur Pos: %f,%f\n",pos.x,pos.y); 369 410 // out of reasons i can't get behind, this version is segfaulting when calling getSizeX2D or getSizeY2D. the other 370 411 // element2D- related function works tough.. :s … … 374 415 if (pos.x < overlayWidth*0.2) 375 416 { 376 pos.x = overlayWidth ;417 pos.x = overlayWidth + this->rightRect->getAbsCoor2D().x; 377 418 pos.y += (*weaponWidget)->getSizeX2D(); 378 419 } … … 385 426 386 427 pos.y += 160; 387 pos.x = overlayWidth ;428 pos.x = overlayWidth + this->rightRect->getAbsCoor2D().x; 388 429 for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++) 389 430 { 390 431 if (pos.x < overlayWidth*0.2) 391 432 { 392 pos.x = overlayWidth ;433 pos.x = overlayWidth + this->rightRect->getAbsCoor2D().x; 393 434 pos.y += (*weaponWidget)->getSizeX2D(); 394 435 } -
branches/playability/src/util/hud.h
r10270 r10278 54 54 55 55 void updateWeaponManager(); 56 //void clearWeaponManager(); 56 57 57 58 inline void setOverlayPercentage(int perc)
Note: See TracChangeset
for help on using the changeset viewer.