Changeset 10240 for code/branches/hudHS14/src/modules/overlays/hud
- Timestamp:
- Feb 1, 2015, 8:52:31 PM (10 years ago)
- Location:
- code/branches/hudHS14/src/modules/overlays/hud
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.cc
r10239 r10240 306 306 if (!it->second.wasOutOfView_) 307 307 { 308 309 310 308 it->second.health_->hide(); 309 it->second.healthLevel_->hide(); 310 it->second.panel_->setMaterialName(TextureGenerator::getMaterialName("arrows.png", it->first->getRadarObjectColour())); 311 311 it->second.wasOutOfView_ = true; 312 312 it->second.target_->hide(); … … 370 370 371 371 372 372 //calculate the health of the actual selected radarViewable (relativHealthScale: while (0) is no health left, (1) is the initial health) 373 373 Pawn* pawnPtr = (Pawn*) (it->first->getWorldEntity()); 374 374 float health = pawnPtr->getHealth(); … … 384 384 385 385 if(initHealth < 200) 386 386 HealthLevel = 1; 387 387 if(200 <= initHealth && initHealth < 500) 388 388 HealthLevel = 2; 389 389 if(500 <= initHealth && initHealth < 1000) 390 390 HealthLevel = 3; 391 391 if(1000 <= initHealth && initHealth < 2500) 392 392 HealthLevel = 4; 393 393 if(2500 <= initHealth) 394 395 396 397 398 394 HealthLevel = 5; 395 396 397 398 // Change material only if outOfView changed 399 399 if (it->second.wasOutOfView_) 400 400 { … … 413 413 // spaceship is still intact there should be at least one part of the bar left. 414 414 if(1<=discreteHealthScale){ 415 416 415 it->second.health_->setTiling((float)discreteHealthScale , 1 ,0); 416 it->second.health_->setDimensions(this->healthMarkerSize_ * this->getActualSize().x *0.1f*discreteHealthScale, 0.75f*this->healthMarkerSize_ * this->getActualSize().y); 417 417 } 418 418 … … 510 510 511 511 { 512 512 it->second.health_->hide(); 513 513 it->second.healthLevel_->hide(); 514 514 it->second.panel_->hide(); 515 515 it->second.text_->hide(); 516 516 it->second.target_->hide(); … … 535 535 for (std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end(); ++it) 536 536 { 537 538 539 540 537 if (it->second.health_ != NULL) 538 it->second.health_->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale); 539 if (it->second.healthLevel_ != NULL) 540 it->second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * xScale, this->healthLevelMarkerSize_ * yScale); 541 541 if (it->second.panel_ != NULL) 542 542 it->second.panel_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale); … … 627 627 { 628 628 // Detach overlays 629 630 629 this->background_->removeChild(it->second.health_->getName()); 630 this->background_->removeChild(it->second.healthLevel_->getName()); 631 631 this->background_->removeChild(it->second.panel_->getName()); 632 632 this->background_->removeChild(it->second.target_->getName()); -
code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.h
r10163 r10240 80 80 81 81 82 83 84 82 Ogre::PanelOverlayElement* health_; 83 Ogre::PanelOverlayElement* healthLevel_; 84 Ogre::PanelOverlayElement* panel_; 85 85 Ogre::PanelOverlayElement* target_; 86 86 Ogre::TextAreaOverlayElement* text_; … … 99 99 } 100 100 inline float getHealthMarkerSize() const 101 101 { return healthMarkerSize_; } 102 102 103 103 inline void setHealthLevelMarkerSize(float size) … … 107 107 } 108 108 inline float getHealthLevelMarkerSize() const 109 109 { return healthLevelMarkerSize_; } 110 110 111 111 inline void setNavMarkerSize(float size)
Note: See TracChangeset
for help on using the changeset viewer.