- Timestamp:
- Oct 29, 2008, 11:55:37 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/overlays/hud/HUDRadar.cc
r2019 r2046 46 46 CreateFactory(HUDRadar); 47 47 48 HUDRadar::HUDRadar(BaseObject* creator) : OrxonoxOverlay(creator), marker_(0) 48 HUDRadar::HUDRadar(BaseObject* creator) 49 : OrxonoxOverlay(creator) 49 50 { 50 51 RegisterObject(HUDRadar); 52 53 marker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 54 .createOverlayElement("Panel", "HUDRadar_marker_" + getUniqueNumberString())); 55 marker_->setMaterialName("Orxonox/RadarMarker"); 56 overlay_->add2D(marker_); 57 marker_->hide(); 58 59 setRadarSensitivity(1.0f); 60 setHalfDotSizeDistance(3000.0f); 61 setMaximumDotSize(0.1f); 62 63 shapeMaterials_[RadarViewable::Dot] = "RadarSquare.tga"; 64 shapeMaterials_[RadarViewable::Triangle] = "RadarSquare.tga"; 65 shapeMaterials_[RadarViewable::Square] = "RadarSquare.tga"; 51 66 } 52 67 53 68 HUDRadar::~HUDRadar() 54 69 { 55 if (this->marker_) 70 if (this->isInitialized()) 71 { 56 72 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->marker_); 57 for (std::vector<Ogre::PanelOverlayElement*>::iterator it = this->radarDots_.begin(); 58 it != this->radarDots_.end(); ++it) 59 { 60 Ogre::OverlayManager::getSingleton().destroyOverlayElement(*it); 73 for (std::vector<Ogre::PanelOverlayElement*>::iterator it = this->radarDots_.begin(); 74 it != this->radarDots_.end(); ++it) 75 { 76 Ogre::OverlayManager::getSingleton().destroyOverlayElement(*it); 77 } 61 78 } 62 79 } … … 66 83 SUPER(HUDRadar, XMLPort, xmlElement, mode); 67 84 68 if (mode == XMLPort::LoadObject) 69 { 70 marker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 71 .createOverlayElement("Panel", "HUDRadar_marker_" + getUniqueNumberString())); 72 marker_->setMaterialName("Orxonox/RadarMarker"); 73 overlay_->add2D(marker_); 74 marker_->hide(); 75 } 76 77 XMLPortParam(HUDRadar, "sensitivity", setRadarSensitivity, getRadarSensitivity, xmlElement, mode) 78 .defaultValues(1.0f); 79 XMLPortParam(HUDRadar, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, 80 xmlElement, mode).defaultValues(3000.0f); 81 XMLPortParam(HUDRadar, "maximumDotSize", setMaximumDotSize, getMaximumDotSize, xmlElement, mode) 82 .defaultValues(0.1f); 83 84 shapeMaterials_[RadarViewable::Dot] = "RadarSquare.tga"; 85 shapeMaterials_[RadarViewable::Triangle] = "RadarSquare.tga"; 86 shapeMaterials_[RadarViewable::Square] = "RadarSquare.tga"; 85 XMLPortParam(HUDRadar, "sensitivity", setRadarSensitivity, getRadarSensitivity, xmlElement, mode); 86 XMLPortParam(HUDRadar, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, xmlElement, mode); 87 XMLPortParam(HUDRadar, "maximumDotSize", setMaximumDotSize, getMaximumDotSize, xmlElement, mode); 87 88 } 88 89
Note: See TracChangeset
for help on using the changeset viewer.