Changeset 10110
- Timestamp:
- Nov 5, 2014, 4:04:51 PM (10 years ago)
- Location:
- code/branches/hudHS14
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hudHS14/data/overlays/HUDTemplates3.oxo
r9939 r10110 36 36 size = "0.35, 0.0875" 37 37 position = "0.0 , 0.9 " 38 pickpoint = "0, 1" 38 pickpoint = "0, 1" 39 39 bartexture = "healthbar_bar.png" 40 40 textfont = "VeraMono" … … 82 82 background = "Orxonox/HealthBarBackground" 83 83 size = "0.35, 0.0875" 84 position = "1 .0 , 0.1"85 pickpoint = " 1, 1"84 position = "1 ,0" 85 pickpoint = "0.6, 0.5" 86 86 bartexture = "healthbar_bar.png" 87 87 textfont = "VeraMono" … … 89 89 textsize = 0.039 90 90 textoffset = "0.315, 0.05" 91 textpickpoint = " 0, 0"91 textpickpoint = "2, 1" 92 92 textalign = "right" 93 93 correctaspect = false -
code/branches/hudHS14/src/modules/overlays/hud/HUDEnemyHealthBar.cc
r9667 r10110 31 31 #include "core/config/ConfigValueIncludes.h" 32 32 #include "worldentities/pawns/Pawn.h" 33 #include "graphics/Camera.h" 33 34 34 35 namespace orxonox … … 57 58 this->updateTarget(); 58 59 60 61 62 63 /* 64 //-------------------------------------------------------------------------- 65 //first try to place a healthbar under the enemy ship 66 //getting all the parameters (direction, position, angle) to place the health bar on the screen 67 68 Camera* camera = this->owner_->getCamera(); 69 70 //position and orientation relative to the root space 71 Vector3 cameraPosition = camera->getWorldPosition(); 72 Quaternion cameraOrientation = camera->getWorldOrientation(); 73 74 Vector3 cameraDirection = camera->FRONT; 75 Vector3 cameraOrthonormal = camera->UP; 76 77 //get target 78 //if there is one get it's position (relative to the root space( 79 WorldEntity* target = this->owner_->getTarget(); 80 81 if(target != NULL){ 82 Vector3 targetPosition = target->getWorldPosition(); 83 84 85 //try 1 86 Vector2 screenCoordinates = get2DViewcoordinates(cameraPosition, cameraOrientation * WorldEntity::FRONT, cameraOrientation * WorldEntity::UP, targetPosition); 87 88 orxout() << screenCoordinates.x << endl; 89 90 //shift coordinates because the screen has it's root in the upper left corner (0,0) but get2Dviewcoordiantes return values between -0.5 and 0.5 91 screenCoordinates.x += 0.5; 92 screenCoordinates.y += 0.5; 93 orxout() << screenCoordinates.x << endl; 94 95 this->setPosition(screenCoordinates); 96 97 this->setTextOffset(screenCoordinates); 98 99 100 101 102 103 } 104 105 //-------------------------------------------------------------------------- 106 */ 107 108 59 109 SUPER(HUDEnemyHealthBar, tick, dt); 60 110 } … … 71 121 target = target->getParent(); 72 122 pawn = orxonox_cast<Pawn*>(target); 123 124 125 126 /*Vector3 tempPosition = target->getWorldPosition(); 127 Vector2 tempPos2D = Vector2(tempPosition.x, tempPosition.y); 128 this->pickPoint_(tempPos2D); 129 this->position_(tempPos2D);*/ 130 131 73 132 // Don't show the HealthBar if the pawn is invisible 74 133 if (pawn && !pawn->isVisible()) 75 134 pawn = NULL; 76 135 } 136 77 137 // Set the pawn as owner of the HealthBar 78 138 this->setHealthBarOwner(pawn); -
code/branches/hudHS14/src/modules/overlays/hud/HUDHealthBar.cc
r9667 r10110 83 83 SUPER(HUDHealthBar, tick, dt); 84 84 85 86 87 88 85 89 if (this->owner_) 86 90 { -
code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.cc
r9939 r10110 298 298 if (!it->second.wasOutOfView_) 299 299 { 300 it->second.panel_->setMaterialName(TextureGenerator::getMaterialName("arrows.png", it->first->getRadarObjectColour())); 300 it->second.health_->hide(); 301 it->second.panel_->setMaterialName(TextureGenerator::getMaterialName("arrows.png", it->first->getRadarObjectColour())); 301 302 it->second.wasOutOfView_ = true; 302 303 it->second.target_->hide(); … … 364 365 it->second.panel_->setDimensions(this->navMarkerSize_ * this->getActualSize().x, this->navMarkerSize_ * this->getActualSize().y); 365 366 it->second.target_->setDimensions(this->aimMarkerSize_ * this->getActualSize().x, this->aimMarkerSize_ * this->getActualSize().y); 367 368 //manipulation bzw versuch !!! Jonas 369 it->second.health_->setMaterialName(TextureGenerator::getMaterialName("bar2b.png", it->first->getRadarObjectColour())); 370 366 371 it->second.wasOutOfView_ = false; 367 372 } 373 374 // Position health (versuch !!!!) 375 it->second.health_->setLeft((pos.x + 1.0f - it->second.panel_->getWidth()) * 0.5f); 376 it->second.health_->setTop((-pos.y + 1.0f - it->second.panel_->getHeight()) * 0.5f); 377 368 378 369 379 // Position marker … … 377 387 378 388 // Make sure the overlays are shown 389 390 it->second.health_->show(); 379 391 it->second.panel_->show(); 380 392 it->second.text_->show(); … … 419 431 420 432 { 433 it->second.health_->hide() 421 434 it->second.panel_->hide(); 422 435 it->second.text_->hide(); … … 442 455 for (std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end(); ++it) 443 456 { 457 if (it->second.health_ != NULL) 458 it->second.health_->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale); 444 459 if (it->second.panel_ != NULL) 445 460 it->second.panel_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale); … … 468 483 469 484 // Create everything needed to display the object on the radar and add it to the map 485 // Create health 486 Ogre::PanelOverlayElement* health = static_cast<Ogre::PanelOverlayElement*>( Ogre::OverlayManager::getSingleton() 487 .createOverlayElement("Panel", "HUDNavigation_healthMarker_" + getUniqueNumberString())); 488 //panel->setMaterialName("Orxonox/NavTDC"); 489 health->setMaterialName(TextureGenerator::getMaterialName("bar2b.png", object->getRadarObjectColour())); 490 health->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale); 491 //panel->setColour(object->getRadarObjectColour()); 492 470 493 471 494 // Create arrow/marker … … 490 513 text->setColour(object->getRadarObjectColour()); 491 514 515 health->hide(); 492 516 panel->hide(); 493 517 target->hide(); … … 495 519 496 520 ObjectInfo tempStruct = 497 { panel, target, text, false, false, false};521 { health, panel, target, text, false, false, false, false}; 498 522 this->activeObjectList_[object] = tempStruct; 499 523 524 this->background_->addChild(health); 500 525 this->background_->addChild(panel); 501 526 this->background_->addChild(target); … … 512 537 { 513 538 // Detach overlays 539 this->background_->removeChild(it->second.health_->getName()); 514 540 this->background_->removeChild(it->second.panel_->getName()); 515 541 this->background_->removeChild(it->second.target_->getName()); 516 542 this->background_->removeChild(it->second.text_->getName()); 517 543 // Properly destroy the overlay elements (do not use delete!) 544 Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.health_); 518 545 Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.panel_); 519 546 Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.target_); -
code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.h
r9667 r10110 77 77 struct ObjectInfo 78 78 { 79 Ogre::PanelOverlayElement* panel_; 79 80 //manipulation bzw versuch !!! Jonas 81 Ogre::PanelOverlayElement* health_; 82 83 Ogre::PanelOverlayElement* panel_; 80 84 Ogre::PanelOverlayElement* target_; 81 85 Ogre::TextAreaOverlayElement* text_;
Note: See TracChangeset
for help on using the changeset viewer.