Changeset 1614 for code/branches/hud/src/orxonox/overlays/HUDText.cc
- Timestamp:
- Jun 21, 2008, 2:35:24 PM (17 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud/src/orxonox/overlays/HUDText.cc
r1604 r1614 31 31 32 32 #include <OgreOverlayManager.h> 33 #include <OgreTextAreaOverlayElement.h> 34 #include <OgrePanelOverlayElement.h> 33 35 34 36 #include "util/Convert.h" … … 41 43 42 44 HUDText::HUDText() 43 : background_(0) 44 , text_(0) 45 : text_(0) 45 46 { 46 47 RegisterObject(HUDText); … … 53 54 if (this->text_) 54 55 OverlayManager::getSingleton().destroyOverlayElement(this->text_); 55 if (this->background_)56 OverlayManager::getSingleton().destroyOverlayElement(this->background_);57 56 } 58 57 } … … 64 63 if (mode == XMLPort::LoadObject) 65 64 { 66 // create background67 this->background_ = static_cast<PanelOverlayElement*>(68 OverlayManager::getSingleton().createOverlayElement("Panel", getName() + "_Background"));69 70 65 this->text_ = static_cast<TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton().createOverlayElement("TextArea", getName() + "_Text")); 71 66 this->text_->setCharHeight(1.0f); 72 67 this->text_->setFontName("Monofur"); 73 68 74 this->overlay_->add2D(this->background_);75 69 this->background_->addChild(this->text_); 76 70 } 77 71 78 XMLPortParam(HUDText, "material", setBackgroundMaterial, getBackgroundMaterial, xmlElement, mode);79 72 XMLPortParam(HUDText, "font", setFont, getFont, xmlElement, mode); 80 73 XMLPortParam(HUDText, "caption", setCaption, getCaption, xmlElement, mode); … … 84 77 this->text_->setCaption(this->caption_); 85 78 } 86 }87 88 void HUDText::setBackgroundMaterial(const std::string& material)89 {90 if (this->background_ && material != "")91 this->background_->setMaterialName(material);92 }93 94 std::string HUDText::getBackgroundMaterial() const95 {96 if (this->background_)97 return this->background_->getMaterialName();98 else99 return "";100 79 } 101 80
Note: See TracChangeset
for help on using the changeset viewer.