Changeset 9429 for code/branches/spaceNavigation/src/modules/overlays/hud
- Timestamp:
- Nov 5, 2012, 2:30:37 PM (12 years ago)
- Location:
- code/branches/spaceNavigation/src/modules/overlays/hud
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc
r9421 r9429 72 72 this->setTextSize(0.05f); 73 73 this->setNavMarkerSize(0.05f); 74 this->setAimMarkerSize(0.02f); 75 74 76 this->setDetectionLimit(10000.0f); 75 77 this->currentMunitionSpeed_ = 2500.0f; 76 78 77 Pawn* ship = orxonox_cast<Pawn*>(this->getOwner());79 /*Pawn* ship = orxonox_cast<Pawn*>(this->getOwner()); 78 80 if(ship != NULL) 79 this->ship_ = ship; 81 this->ship_ = ship;*/ 80 82 } 81 83 … … 104 106 XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode); 105 107 XMLPortParam(HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode); 108 XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlelement, mode); 106 109 } 107 110 … … 290 293 it->second.panel_->setMaterialName(TextureGenerator::getMaterialName("tdc.png", it->first->getRadarObjectColour())); 291 294 it->second.panel_->setDimensions(this->navMarkerSize_ * this->getActualSize().x, this->navMarkerSize_ * this->getActualSize().y); 295 it->second.target_->setDimensions(aimMarkerSize_ * this->getActualSize().x, this->aimMarkerSize_ * this->getActualSize().y); 292 296 it->second.wasOutOfView_ = false; 293 297 } … … 298 302 it->second.panel_->setTop((-pos.y + 1.0f - it->second.panel_->getHeight()) * 0.5f); 299 303 300 // TODO : Target marker 304 // Position text 305 it->second.text_->setLeft((pos.x + 1.0f + it->second.panel_->getWidth()) * 0.5f); 306 it->second.text_->setTop((-pos.y + 1.0f + it->second.panel_->getHeight()) * 0.5f); 307 308 // Target marker 301 309 Vector3* targetPos = this->toAimPosition(it->first); 302 310 Vector3 screenPos = camTransform * *targetPos; … … 309 317 else 310 318 { 311 it->second.target_->show();312 319 it->second.target_->setLeft((screenPos.x + 1.0f - it->second.target_->getWidth()) * 0.5f); 313 320 it->second.target_->setTop((-screenPos.y + 1.0f - it->second.target_->getHeight()) * 0.5f); 314 }315 316 orxout() << targetPos->x << endl; 321 it->second.target_->show(); 322 } 323 317 324 delete targetPos; 318 319 // Position text320 it->second.text_->setLeft((pos.x + 1.0f + it->second.panel_->getWidth()) * 0.5f);321 it->second.text_->setTop((-pos.y + 1.0f + it->second.panel_->getHeight()) * 0.5f);322 325 } 323 326 … … 331 334 it->second.panel_->hide(); 332 335 it->second.text_->hide(); 333 it->second.target_->hide(); // TODO :336 it->second.target_->hide(); 334 337 } 335 338 } … … 354 357 it->second.text_->setCharHeight(it->second.text_->getCharHeight() * yScale); 355 358 if (it->second.target_ != NULL) 356 it->second.target_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale); 357 // TODO : targetMarkerSize_ ??? 359 it->second.target_->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale); 358 360 } 359 361 } … … 388 390 Ogre::PanelOverlayElement* target = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 389 391 .createOverlayElement("Panel", "HUDNavigation_targetMarker_" + getUniqueNumberString())); 390 target->setMaterialName(TextureGenerator::getMaterialName("target.png" /* TODO : create the target picture */, object->getRadarObjectColour()));391 target->setDimensions(this-> navMarkerSize_ * xScale, this->navMarkerSize_ * yScale);392 target->setMaterialName(TextureGenerator::getMaterialName("target.png", object->getRadarObjectColour())); 393 target->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale); 392 394 393 395 // Create text -
code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h
r9421 r9429 91 91 inline float getNavMarkerSize() const 92 92 { return navMarkerSize_; } 93 inline void setAimMarkerSize(float size) 94 { 95 aimMarkerSize_ = size; 96 this->sizeChanged(); 97 } 98 inline float getAimMarkerSize() const 99 { return aimMarkerSize_; } 93 100 inline void setDetectionLimit(float limit) 94 101 { this->detectionLimit_ = limit; } … … 111 118 112 119 float navMarkerSize_; 120 float aimMarkerSize_; 113 121 std::string fontName_; 114 122 float textSize_;
Note: See TracChangeset
for help on using the changeset viewer.