- 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/HUDNavigation.cc
r2019 r2046 48 48 HUDNavigation::HUDNavigation(BaseObject* creator) 49 49 : OrxonoxOverlay(creator) 50 , navMarker_(0)51 , aimMarker_(0)52 , navText_(0)53 50 { 54 51 RegisterObject(HUDNavigation); 52 53 // create nav text 54 navText_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton() 55 .createOverlayElement("TextArea", "HUDNavigation_navText_" + getUniqueNumberString())); 56 57 // create nav marker 58 navMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 59 .createOverlayElement("Panel", "HUDNavigation_navMarker_" + getUniqueNumberString())); 60 navMarker_->setMaterialName("Orxonox/NavArrows"); 61 62 // create aim marker 63 aimMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 64 .createOverlayElement("Panel", "HUDNavigation_aimMarker_" + getUniqueNumberString())); 65 aimMarker_->setMaterialName("Orxonox/NavCrosshair"); 66 this->wasOutOfView_ = true; // Ensure the material is changed right the first time.. 67 68 setFont("Monofur"); 69 setTextSize(0.05f); 70 setNavMarkerSize(0.05f); 71 setAimMarkerSize(0.04f); 72 73 background_->addChild(navMarker_); 74 background_->addChild(aimMarker_); 75 background_->addChild(navText_); 76 77 // hide at first 78 this->setVisible(false); 55 79 } 56 80 57 81 HUDNavigation::~HUDNavigation() 58 82 { 59 if (this->navMarker_) 83 if (this->isInitialized()) 84 { 60 85 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navMarker_); 61 if (this->navText_)62 86 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navText_); 63 if (this->aimMarker_)64 87 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_); 88 } 65 89 } 66 90 … … 69 93 SUPER(HUDNavigation, XMLPort, xmlElement, mode); 70 94 71 if (mode == XMLPort::LoadObject) 72 { 73 // create nav text 74 navText_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton() 75 .createOverlayElement("TextArea", "HUDNavigation_navText_" + getUniqueNumberString())); 76 77 // create nav marker 78 navMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 79 .createOverlayElement("Panel", "HUDNavigation_navMarker_" + getUniqueNumberString())); 80 navMarker_->setMaterialName("Orxonox/NavArrows"); 81 wasOutOfView_ = true; // just to ensure the material is changed right the first time.. 82 83 // create aim marker 84 aimMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 85 .createOverlayElement("Panel", "HUDNavigation_aimMarker_" + getUniqueNumberString())); 86 aimMarker_->setMaterialName("Orxonox/NavCrosshair"); 87 88 background_->addChild(navMarker_); 89 background_->addChild(aimMarker_); 90 background_->addChild(navText_); 91 92 // hide at first 93 this->setVisible(false); 94 } 95 96 XMLPortParam(HUDNavigation, "font", setFont, getFont, xmlElement, mode).defaultValues("Monofur"); 97 XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlElement, mode).defaultValues(0.05f); 98 XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlElement, mode) 99 .defaultValues(0.05f); 100 XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode) 101 .defaultValues(0.04f); 95 XMLPortParam(HUDNavigation, "font", setFont, getFont, xmlElement, mode); 96 XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlElement, mode); 97 XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlElement, mode); 98 XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode); 102 99 } 103 100
Note: See TracChangeset
for help on using the changeset viewer.