- Timestamp:
- Oct 28, 2008, 10:55:49 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/overlay/src/orxonox/overlays/OverlayText.cc
r1784 r2036 31 31 32 32 #include <OgreOverlayManager.h> 33 #include <OgreTextAreaOverlayElement.h>34 33 #include <OgrePanelOverlayElement.h> 35 34 … … 46 45 { 47 46 RegisterObject(OverlayText); 47 48 this->text_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton() 49 .createOverlayElement("TextArea", "OverlayText_text_" + getUniqueNumberStr())); 50 this->text_->setCharHeight(1.0); 51 52 this->background_->addChild(this->text_); 48 53 } 49 54 50 55 OverlayText::~OverlayText() 51 56 { 52 if (this-> text_)57 if (this->isInitialized()) 53 58 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->text_); 54 59 } … … 57 62 { 58 63 SUPER(OverlayText, XMLPort, xmlElement, mode); 59 60 if (mode == XMLPort::LoadObject)61 {62 this->text_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton()63 .createOverlayElement("TextArea", "OverlayText_text_" + getUniqueNumberStr()));64 this->text_->setCharHeight(1.0);65 66 this->background_->addChild(this->text_);67 }68 64 69 65 XMLPortParam(OverlayText, "font", setFont, getFont, xmlElement, mode).defaultValues("Monofur"); … … 74 70 void OverlayText::setFont(const std::string& font) 75 71 { 76 if ( this->text_ &&font != "")72 if (font != "") 77 73 this->text_->setFontName(font); 78 74 } … … 80 76 const std::string& OverlayText::getFont() const 81 77 { 82 if (this->text_) 83 return this->text_->getFontName(); 84 else 85 return blankString; 78 return this->text_->getFontName(); 86 79 } 87 80
Note: See TracChangeset
for help on using the changeset viewer.