Changeset 6897 for code/branches/hudelements/src/modules/overlays
- Timestamp:
- May 11, 2010, 2:56:32 PM (15 years ago)
- Location:
- code/branches/hudelements/src/modules/overlays/hud
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hudelements/src/modules/overlays/hud/HUDNavigation.cc
r6886 r6897 46 46 #include "worldentities/pawns/Pawn.h" 47 47 #include "worldentities/WorldEntity.h" 48 #include "interfaces/RadarViewable.h" 48 49 49 50 namespace orxonox … … 55 56 { 56 57 RegisterObject(HUDNavigation); 57 58 59 const std::set<RadarViewable*>& respawnObjectSet_ = this->getOwner()->getScene()->getRadar()->getRadarObjects(); 60 std::set<RadarViewable*>::const_iterator respawnObjectSetIt_; 61 62 if(!respawnObjectSet_.empty()){ 63 for(respawnObjectSetIt_ = respawnObjectSet_.begin(); respawnObjectSetIt_ != respawnObjectSet_.end(); 64 ++respawnObjectSetIt_){ addObject(*respawnObjectSetIt_);} 65 } 58 59 setFont("Monofur"); 60 setTextSize(0.05f); 61 setNavMarkerSize(0.05f); 62 63 respawnObjectSet_ = this->getOwner()->getScene()->getRadar()->getRadarObjects(); 64 65 for (respawnObjectSetIt_ = respawnObjectSet_.begin(); respawnObjectSetIt_ != respawnObjectSet_.end(); 66 ++respawnObjectSetIt_) 67 { 68 if (!(*respawnObjectSetIt_)->isHumanShip_) addObject(*respawnObjectSetIt_); 69 } 66 70 67 71 // // create nav text … … 74 78 // navMarker_->setMaterialName("Orxonox/NavArrows"); 75 79 76 /*77 // create aim marker78 aimMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()79 .createOverlayElement("Panel", "HUDNavigation_aimMarker_" + getUniqueNumberString()));80 aimMarker_->setMaterialName("Orxonox/NavCrosshair");81 this->wasOutOfView_ = true; // Ensure the material is changed right the first time..82 83 84 */85 /*86 background_->addChild(navMarker_);*/80 /* 81 // create aim marker 82 aimMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 83 .createOverlayElement("Panel", "HUDNavigation_aimMarker_" + getUniqueNumberString())); 84 aimMarker_->setMaterialName("Orxonox/NavCrosshair"); 85 this->wasOutOfView_ = true; // Ensure the material is changed right the first time.. 86 87 88 */ 89 /* 90 background_->addChild(navMarker_);*/ 87 91 // background_->addChild(aimMarker_); 88 92 // background_->addChild(navText_); 89 93 90 // hide at first94 // hide at first 91 95 // this->setVisible(false); 92 96 93 97 94 setFont("Monofur"); 95 setTextSize(0.05f); 96 setNavMarkerSize(0.05f); 98 97 99 // setAimMarkerSize(0.04f); 98 } 99 100 HUDNavigation::~HUDNavigation() 101 {100 101 } 102 103 HUDNavigation::~HUDNavigation() { 102 104 103 105 if (this->isInitialized()) 104 106 { 105 if (!activeObjectList_.empty()) 106 { 107 for (tempRadarViewable = activeObjectList_.begin(); tempRadarViewable!=activeObjectList_.end(); ++tempRadarViewable) 108 { 109 Ogre::OverlayManager::getSingleton().destroyOverlayElement(tempRadarViewable->second.first); 110 Ogre::OverlayManager::getSingleton().destroyOverlayElement(tempRadarViewable->second.second); 111 // Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_); 112 } 113 } 114 } 115 } 116 117 void HUDNavigation::XMLPort(Element& xmlElement, XMLPort::Mode mode) 118 { 107 activeObjectList_.clear(); 108 respawnObjectSet_.clear(); 109 } 110 } 111 112 void HUDNavigation::XMLPort(Element& xmlElement, XMLPort::Mode mode) { 119 113 SUPER(HUDNavigation, XMLPort, xmlElement, mode); 120 114 … … 304 298 tempRadarViewable->second.second->setTop((-pos.y + 1.0f + tempRadarViewable->second.first->getHeight()) * 0.5f); 305 299 } 306 307 tempRadarViewable->second.first->show();308 tempRadarViewable->second.second->show();309 }300 301 tempRadarViewable->second.first->show(); 302 tempRadarViewable->second.second->show(); 303 } 310 304 311 305 } … … 398 392 } 399 393 394 // void HUDRadar::changedOwner() { 395 // SUPER(HUDRadar, changedOwner); 396 // 397 // this->owner_ = orxonox_cast<Pawn*>(this->getOwner()); 398 // assert(this->radarObjects_.size()==0); 399 // this->gatherObjects(); 400 // } 401 400 402 // void updateActiveObjectList(map activeObjectList_){} 401 403 // -
code/branches/hudelements/src/modules/overlays/hud/HUDNavigation.h
r6874 r6897 33 33 #include <map> 34 34 #include "overlays/OverlaysPrereqs.h" 35 #include "interfaces/RadarViewable.h" 35 36 36 37 #include "interfaces/RadarListener.h" … … 57 58 inline float getRadarSensitivity() const {return 1.0f;} 58 59 inline void radarTick(float dt) {} 60 // virtual void changedOwner(); 59 61 60 62 … … 111 113 activeObjectListType activeObjectList_; 112 114 activeObjectListType::iterator tempRadarViewable; 115 116 typedef std::set<RadarViewable*> respawnObjectSetType; 117 respawnObjectSetType respawnObjectSet_; 118 respawnObjectSetType::iterator respawnObjectSetIt_; 113 119 114 120 std::string fontName_; -
code/branches/hudelements/src/modules/overlays/hud/HUDRadar.cc
r6849 r6897 188 188 void HUDRadar::changedOwner() 189 189 { 190 190 SUPER(HUDRadar, changedOwner); 191 191 192 this->owner_ = orxonox_cast<Pawn*>(this->getOwner()); 193 assert(this->radarObjects_.size()==0); 194 this->gatherObjects(); 195 } 192 this->owner_ = orxonox_cast<Pawn*>(this->getOwner()); 193 assert(this->radarObjects_.size()==0); 194 this->gatherObjects(); 196 195 } 196 }
Note: See TracChangeset
for help on using the changeset viewer.