- Timestamp:
- Oct 22, 2008, 5:25:01 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/overlays/OverlayText.cc
r1784 r1993 31 31 32 32 #include <OgreOverlayManager.h> 33 #include <OgreTextAreaOverlayElement.h>34 33 #include <OgrePanelOverlayElement.h> 35 34 … … 68 67 69 68 XMLPortParam(OverlayText, "font", setFont, getFont, xmlElement, mode).defaultValues("Monofur"); 69 XMLPortParam(OverlayText, "colour", setColour, getColour, xmlElement, mode).defaultValues(ColourValue(1.0, 1.0, 1.0, 1.0)); 70 70 XMLPortParam(OverlayText, "caption", setCaption, getCaption, xmlElement, mode).defaultValues(""); 71 71 XMLPortParam(OverlayText, "textSize", setTextSize, getTextSize, xmlElement, mode).defaultValues(1.0f); 72 XMLPortParamTemplate(OverlayText, "align", setAlignment, getAlignment, xmlElement, mode, const std::string&).defaultValues("left"); 72 73 } 73 74 … … 84 85 else 85 86 return blankString; 87 } 88 89 void OverlayText::setColour(const ColourValue& colour) 90 { 91 if (this->text_) 92 this->text_->setColour(colour); 93 } 94 95 const ColourValue& OverlayText::getColour() const 96 { 97 if (this->text_) 98 return this->text_->getColour(); 99 else 100 return ColourValue::White; 101 } 102 103 void OverlayText::setAlignment(Ogre::TextAreaOverlayElement::Alignment alignment) 104 { 105 if (this->text_) 106 this->text_->setAlignment(alignment); 107 } 108 109 void OverlayText::setAlignment(const std::string& alignment) 110 { 111 if (alignment == "right") 112 this->setAlignment(Ogre::TextAreaOverlayElement::Right); 113 else if (alignment == "center") 114 this->setAlignment(Ogre::TextAreaOverlayElement::Center); 115 else // "left" and default 116 this->setAlignment(Ogre::TextAreaOverlayElement::Left); 117 } 118 119 std::string OverlayText::getAlignment() const 120 { 121 if (this->text_) 122 { 123 Ogre::TextAreaOverlayElement::Alignment alignment = this->text_->getAlignment(); 124 125 switch (alignment) 126 { 127 case Ogre::TextAreaOverlayElement::Right: 128 return "right"; 129 case Ogre::TextAreaOverlayElement::Center: 130 return "center"; 131 case Ogre::TextAreaOverlayElement::Left: 132 default:; 133 } 134 } 135 return "left"; 136 } 137 138 void OverlayText::setCaption(const std::string& caption) 139 { 140 this->caption_ = caption; 141 this->text_->setCaption(caption); 86 142 } 87 143
Note: See TracChangeset
for help on using the changeset viewer.