Changeset 10149 for code/branches/hudHS14/src/modules
- Timestamp:
- Dec 3, 2014, 4:16:49 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.cc
r10143 r10149 82 82 this->setNavMarkerSize(0.03f); 83 83 this->setAimMarkerSize(0.02f); 84 this->setHealthMarkerSize(0.0 8f);84 this->setHealthMarkerSize(0.06f); 85 85 86 86 this->setDetectionLimit(10000.0f); … … 367 367 368 368 369 //calculate the health of the actual selected radarViewable (while (0) is no health left, (1) is the initial health) 370 371 Pawn* pawnPtr = (Pawn*) (it->first->getWorldEntity()); 372 float health = pawnPtr->getHealth(); 373 float initHealth = pawnPtr->getMaxHealth(); 374 float relativHealthScale = health/initHealth; 375 376 //values from 0 to 10 377 int discreteHealthScale = 10*relativHealthScale; 369 378 370 379 … … 379 388 380 389 // 381 it->second.health_->setMaterialName(TextureGenerator::getMaterialName("bar2.png", it->first->getRadarObjectColour())); 382 it->second.health_->setDimensions(this->healthMarkerSize_ * this->getActualSize().x , this->healthMarkerSize_ * this->getActualSize().y); 390 //it->second.health_->setMaterialName(TextureGenerator::getMaterialName("bar2_1.png", it->first->getRadarObjectColour())); 391 it->second.health_->setMaterialName(TextureGenerator::getMaterialName("barSquare.png", it->first->getRadarObjectColour())); 392 it->second.health_->setDimensions(this->healthMarkerSize_ * this->getActualSize().x , 0.75*this->healthMarkerSize_ * this->getActualSize().y); 383 393 it->second.wasOutOfView_ = false; 384 } 385 386 387 //calculate the health of the actual selected radarViewable (while (0) is no health left, (1) is the initial health) 388 389 Pawn* pawnPtr = (Pawn*) (it->first->getWorldEntity()); 390 float health = pawnPtr->getHealth(); 391 float initHealth = pawnPtr->getMaxHealth(); 392 float relativHealthScale = health/initHealth; 394 395 if(1<=discreteHealthScale){ 396 it->second.health_->setTiling((float)discreteHealthScale , 1 ,0); 397 it->second.health_->setDimensions(this->healthMarkerSize_ * this->getActualSize().x *0.1*discreteHealthScale, 0.75*this->healthMarkerSize_ * this->getActualSize().y); 398 } 399 } 400 393 401 394 402 … … 396 404 it->second.health_->setUV(0.0f, 0.0f, 1.0f, 1.0f); 397 405 it->second.health_->setLeft((pos.x + 0.975f - it->second.panel_->getWidth()) * 0.5f); 398 it->second.health_->setTop((-pos.y + 1.025f - it->second.panel_->getHeight()) * 0.5f); 399 it->second.health_->setDimensions(this->healthMarkerSize_ * this->getActualSize().x * relativHealthScale, this->healthMarkerSize_ * this->getActualSize().y); 400 orxout() << relativHealthScale << endl; 406 it->second.health_->setTop((-pos.y + 1.04f - it->second.panel_->getHeight()) * 0.5f); 407 // it->second.health_->setDimensions(this->healthMarkerSize_ * this->getActualSize().x * relativHealthScale, 0.75*this->healthMarkerSize_ * this->getActualSize().y); 408 409 410 if(1<=discreteHealthScale){ 411 it->second.health_->setTiling((float)discreteHealthScale , 1 ,0); 412 it->second.health_->setDimensions(this->healthMarkerSize_ * this->getActualSize().x *0.1*discreteHealthScale, 0.75*this->healthMarkerSize_ * this->getActualSize().y); 413 } 414 401 415 402 416 … … 507 521 508 522 // Create everything needed to display the object on the radar and add it to the map 523 509 524 // Create health 510 525 Ogre::PanelOverlayElement* health = static_cast<Ogre::PanelOverlayElement*>( Ogre::OverlayManager::getSingleton() 511 526 .createOverlayElement("Panel", "HUDNavigation_healthMarker_" + getUniqueNumberString())); 512 527 //panel->setMaterialName("Orxonox/NavTDC"); 513 health->setMaterialName(TextureGenerator::getMaterialName("bar 2.png", object->getRadarObjectColour()));528 health->setMaterialName(TextureGenerator::getMaterialName("barSquare.png", object->getRadarObjectColour())); 514 529 health->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale); 515 530 //panel->setColour(object->getRadarObjectColour());
Note: See TracChangeset
for help on using the changeset viewer.