Changeset 2046 for code/branches/objecthierarchy/src
- Timestamp:
- Oct 29, 2008, 11:55:37 AM (16 years ago)
- Location:
- code/branches/objecthierarchy/src/orxonox/overlays
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/overlays/OrxonoxOverlay.cc
r2023 r2046 56 56 OrxonoxOverlay::OrxonoxOverlay(BaseObject* creator) 57 57 : BaseObject(creator) 58 , overlay_(0)59 , background_(0)60 58 { 61 59 RegisterObject(OrxonoxOverlay); 60 61 // add this overlay to the static map of OrxonoxOverlays 62 if (overlays_s.find(this->getName()) != overlays_s.end()) 63 { 64 COUT(1) << "Overlay names should be unique or you cannnot access them via console." << std::endl; 65 } 66 overlays_s[this->getName()] = this; 67 68 // create the Ogre::Overlay 69 overlay_ = Ogre::OverlayManager::getSingleton().create("OrxonoxOverlay_overlay_" 70 + convertToString(hudOverlayCounter_s++)); 71 72 // create background panel (can be used to show any picture) 73 this->background_ = static_cast<Ogre::PanelOverlayElement*>( 74 Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", 75 "OrxonoxOverlay_background_" + convertToString(hudOverlayCounter_s++))); 76 this->overlay_->add2D(this->background_); 77 78 // We'll have to get the aspect ratio manually for the first time. Afterwards windowResized() gets 79 // called automatically by GSGraphics. 80 this->windowAspectRatio_ = Ogre::OverlayManager::getSingleton().getViewportAspectRatio(); 81 this->sizeCorrectionChanged(); 82 83 this->changedVisibility(); 84 85 setSize(Vector2(1.0f, 1.0f)); 86 setPickPoint(Vector2(0.0f, 0.0f)); 87 setPosition(Vector2(0.0f, 0.0f)); 88 setRotation(Degree(0.0)); 89 setAspectCorrection(true); 90 setBackgroundMaterial(""); 62 91 } 63 92 … … 70 99 OrxonoxOverlay::~OrxonoxOverlay() 71 100 { 72 // erase ourself from the map with all overlays 73 std::map<std::string, OrxonoxOverlay*>::iterator it = overlays_s.find(this->getName()); 74 if (it != overlays_s.end()) 75 overlays_s.erase(it); 76 77 if (this->background_) 101 if (this->isInitialized()) 102 { 103 // erase ourself from the map with all overlays 104 std::map<std::string, OrxonoxOverlay*>::iterator it = overlays_s.find(this->getName()); 105 if (it != overlays_s.end()) 106 overlays_s.erase(it); 107 78 108 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->background_); 79 if (this->overlay_)80 109 Ogre::OverlayManager::getSingleton().destroy(this->overlay_); 110 } 81 111 } 82 112 … … 94 124 SUPER(OrxonoxOverlay, XMLPort, xmlElement, mode); 95 125 96 if (mode == XMLPort::LoadObject) 97 { 98 // add this overlay to the static map of OrxonoxOverlays 99 if (overlays_s.find(this->getName()) != overlays_s.end()) 100 { 101 COUT(1) << "Overlay names should be unique or you cannnot access them via console." << std::endl; 102 } 103 overlays_s[this->getName()] = this; 104 105 // create the Ogre::Overlay 106 overlay_ = Ogre::OverlayManager::getSingleton().create("OrxonoxOverlay_overlay_" 107 + convertToString(hudOverlayCounter_s++)); 108 109 // create background panel (can be used to show any picture) 110 this->background_ = static_cast<Ogre::PanelOverlayElement*>( 111 Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", 112 "OrxonoxOverlay_background_" + convertToString(hudOverlayCounter_s++))); 113 this->overlay_->add2D(this->background_); 114 115 // We'll have to get the aspect ratio manually for the first time. Afterwards windowResized() gets 116 // called automatically by GSGraphics. 117 //this->windowResized(GraphicsEngine::getInstance().getWindowWidth(), 118 // GraphicsEngine::getInstance().getWindowHeight()); 119 this->windowAspectRatio_ = Ogre::OverlayManager::getSingleton().getViewportAspectRatio(); 120 this->sizeCorrectionChanged(); 121 122 this->changedVisibility(); 123 } 124 125 XMLPortParam(OrxonoxOverlay, "size", setSize, getSize, xmlElement, mode) 126 .defaultValues(Vector2(1.0f, 1.0f)); 127 XMLPortParam(OrxonoxOverlay, "pickPoint", setPickPoint, getPickPoint, xmlElement, mode) 128 .defaultValues(Vector2(0.0f, 0.0f)); 129 XMLPortParam(OrxonoxOverlay, "position", setPosition, getPosition, xmlElement, mode) 130 .defaultValues(Vector2(0.0f, 0.0f)); 131 XMLPortParam(OrxonoxOverlay, "rotation", setRotation, getRotation, xmlElement, mode) 132 .defaultValues(0.0f); 133 XMLPortParam(OrxonoxOverlay, "correctAspect", setAspectCorrection, getAspectCorrection, xmlElement, mode) 134 .defaultValues(true); 135 XMLPortParam(OrxonoxOverlay, "background", setBackgroundMaterial, getBackgroundMaterial, xmlElement, mode) 136 .defaultValues(""); 126 XMLPortParam(OrxonoxOverlay, "size", setSize, getSize, xmlElement, mode); 127 XMLPortParam(OrxonoxOverlay, "pickPoint", setPickPoint, getPickPoint, xmlElement, mode); 128 XMLPortParam(OrxonoxOverlay, "position", setPosition, getPosition, xmlElement, mode); 129 XMLPortParam(OrxonoxOverlay, "rotation", setRotation, getRotation, xmlElement, mode); 130 XMLPortParam(OrxonoxOverlay, "correctAspect", setAspectCorrection, getAspectCorrection, xmlElement, mode); 131 XMLPortParam(OrxonoxOverlay, "background", setBackgroundMaterial, getBackgroundMaterial, xmlElement, mode); 137 132 } 138 133 -
code/branches/objecthierarchy/src/orxonox/overlays/OverlayGroup.cc
r2024 r2046 50 50 SetConsoleCommand(OverlayGroup, scrollGroup, false).accessLevel(AccessLevel::User); 51 51 52 OverlayGroup::OverlayGroup(BaseObject* creator) : BaseObject(creator) 52 OverlayGroup::OverlayGroup(BaseObject* creator) 53 : BaseObject(creator) 53 54 { 54 55 RegisterObject(OverlayGroup); 56 57 setScale(Vector2(1.0, 1.0)); 58 setScroll(Vector2(0.0, 0.0)); 55 59 } 56 60 … … 71 75 SUPER(OverlayGroup, XMLPort, xmlElement, mode); 72 76 73 XMLPortParam(OverlayGroup, "scale", setScale, getScale, xmlElement, mode) .defaultValues(Vector2(1.0, 1.0));74 XMLPortParam(OverlayGroup, "scroll", setScroll, getScroll, xmlElement, mode) .defaultValues(Vector2(0.0, 0.0));77 XMLPortParam(OverlayGroup, "scale", setScale, getScale, xmlElement, mode); 78 XMLPortParam(OverlayGroup, "scroll", setScroll, getScroll, xmlElement, mode); 75 79 // loads all the child elements 76 80 XMLPortObject(OverlayGroup, OrxonoxOverlay, "", addElement, getElement, xmlElement, mode); -
code/branches/objecthierarchy/src/orxonox/overlays/OverlayText.cc
r2024 r2046 41 41 CreateFactory(OverlayText); 42 42 43 OverlayText::OverlayText(BaseObject* creator) : OrxonoxOverlay(creator), text_(0) 43 OverlayText::OverlayText(BaseObject* creator) 44 : OrxonoxOverlay(creator) 44 45 { 45 46 RegisterObject(OverlayText); 47 48 this->text_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton() 49 .createOverlayElement("TextArea", "OverlayText_text_" + getUniqueNumberString())); 50 this->text_->setCharHeight(1.0); 51 52 setFont("Monofur"); 53 setColour(ColourValue(1.0, 1.0, 1.0, 1.0)); 54 setCaption(""); 55 setTextSize(1.0f); 56 setAlignmentString("left"); 57 58 this->background_->addChild(this->text_); 46 59 } 47 60 48 61 OverlayText::~OverlayText() 49 62 { 50 if (this-> text_)63 if (this->isInitialized()) 51 64 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->text_); 52 65 } … … 56 69 SUPER(OverlayText, XMLPort, xmlElement, mode); 57 70 58 if (mode == XMLPort::LoadObject) 59 { 60 this->text_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton() 61 .createOverlayElement("TextArea", "OverlayText_text_" + getUniqueNumberString())); 62 this->text_->setCharHeight(1.0); 63 64 this->background_->addChild(this->text_); 65 } 66 67 XMLPortParam(OverlayText, "font", setFont, getFont, xmlElement, mode).defaultValues("Monofur"); 68 XMLPortParam(OverlayText, "colour", setColour, getColour, xmlElement, mode).defaultValues(ColourValue(1.0, 1.0, 1.0, 1.0)); 69 XMLPortParam(OverlayText, "caption", setCaption, getCaption, xmlElement, mode).defaultValues(""); 70 XMLPortParam(OverlayText, "textSize", setTextSize, getTextSize, xmlElement, mode).defaultValues(1.0f); 71 XMLPortParam(OverlayText, "align", setAlignmentString, getAlignmentString, xmlElement, mode).defaultValues("left"); 71 XMLPortParam(OverlayText, "font", setFont, getFont, xmlElement, mode); 72 XMLPortParam(OverlayText, "colour", setColour, getColour, xmlElement, mode); 73 XMLPortParam(OverlayText, "caption", setCaption, getCaption, xmlElement, mode); 74 XMLPortParam(OverlayText, "textSize", setTextSize, getTextSize, xmlElement, mode); 75 XMLPortParam(OverlayText, "align", setAlignmentString, getAlignmentString, xmlElement, mode); 72 76 } 73 77 74 78 void OverlayText::setFont(const std::string& font) 75 79 { 76 if ( this->text_ &&font != "")80 if (font != "") 77 81 this->text_->setFontName(font); 78 }79 80 const std::string& OverlayText::getFont() const81 {82 if (this->text_)83 return this->text_->getFontName();84 else85 return BLANKSTRING;86 }87 88 void OverlayText::setColour(const ColourValue& colour)89 {90 if (this->text_)91 this->text_->setColour(colour);92 }93 94 const ColourValue& OverlayText::getColour() const95 {96 if (this->text_)97 return this->text_->getColour();98 else99 return ColourValue::White;100 }101 102 void OverlayText::setAlignment(Ogre::TextAreaOverlayElement::Alignment alignment)103 {104 if (this->text_)105 this->text_->setAlignment(alignment);106 }107 108 Ogre::TextAreaOverlayElement::Alignment OverlayText::getAlignment() const109 {110 if (this->text_)111 return this->text_->getAlignment();112 else113 return Ogre::TextAreaOverlayElement::Left;114 82 } 115 83 … … 126 94 std::string OverlayText::getAlignmentString() const 127 95 { 128 if (this->text_) 96 Ogre::TextAreaOverlayElement::Alignment alignment = this->text_->getAlignment(); 97 98 switch (alignment) 129 99 { 130 Ogre::TextAreaOverlayElement::Alignment alignment = this->text_->getAlignment(); 131 132 switch (alignment) 133 { 134 case Ogre::TextAreaOverlayElement::Right: 135 return "right"; 136 case Ogre::TextAreaOverlayElement::Center: 137 return "center"; 138 case Ogre::TextAreaOverlayElement::Left: 139 default:; 140 } 100 case Ogre::TextAreaOverlayElement::Right: 101 return "right"; 102 case Ogre::TextAreaOverlayElement::Center: 103 return "center"; 104 case Ogre::TextAreaOverlayElement::Left: 105 return "left"; 106 default: 107 assert(false); return ""; 141 108 } 142 return "left";143 }144 145 void OverlayText::setCaption(const std::string& caption)146 {147 this->caption_ = caption;148 this->text_->setCaption(caption);149 109 } 150 110 151 111 void OverlayText::sizeChanged() 152 112 { 153 if (!this->overlay_)154 return;155 156 113 if (this->rotState_ == Horizontal) 157 114 this->overlay_->setScale(size_.y * sizeCorrection_.y, size_.y * sizeCorrection_.y); -
code/branches/objecthierarchy/src/orxonox/overlays/OverlayText.h
r2024 r2046 47 47 virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode); 48 48 49 void setCaption(const std::string& caption) ;50 const std::string& getCaption() const { return this->caption_; }49 void setCaption(const std::string& caption) { this->text_->setCaption(caption); } 50 std::string getCaption() const { return this->text_->getCaption(); } 51 51 52 52 void setFont(const std::string& font); 53 const std::string& getFont() const ;53 const std::string& getFont() const { return this->text_->getFontName(); } 54 54 55 void setColour(const ColourValue& colour) ;56 const ColourValue& getColour() const ;55 void setColour(const ColourValue& colour) { this->text_->setColour(colour); } 56 const ColourValue& getColour() const { return this->text_->getColour(); } 57 57 58 void setAlignment(Ogre::TextAreaOverlayElement::Alignment alignment) ;59 Ogre::TextAreaOverlayElement::Alignment getAlignment() const ;58 void setAlignment(Ogre::TextAreaOverlayElement::Alignment alignment) { this->text_->setAlignment(alignment); } 59 Ogre::TextAreaOverlayElement::Alignment getAlignment() const { return this->text_->getAlignment(); } 60 60 61 61 protected: … … 69 69 70 70 Ogre::TextAreaOverlayElement* text_; 71 72 private:73 std::string caption_;74 71 }; 75 72 } -
code/branches/objecthierarchy/src/orxonox/overlays/debug/DebugFPSText.cc
r2019 r2046 50 50 { 51 51 float fps = GraphicsEngine::getInstance().getAverageFramesPerSecond(); 52 this-> text_->setCaption(this->getCaption() +convertToString(fps));52 this->setCaption(convertToString(fps)); 53 53 } 54 54 } -
code/branches/objecthierarchy/src/orxonox/overlays/debug/DebugRTRText.cc
r2019 r2046 50 50 { 51 51 float rtr = GraphicsEngine::getInstance().getAverageTickTime(); 52 this-> text_->setCaption(this->getCaption() +convertToString(rtr));52 this->setCaption(convertToString(rtr)); 53 53 } 54 54 } -
code/branches/objecthierarchy/src/orxonox/overlays/hud/ChatOverlay.cc
r2042 r2046 49 49 CreateFactory(ChatOverlay); 50 50 51 ChatOverlay::ChatOverlay(BaseObject* creator) : OverlayText(creator) 51 ChatOverlay::ChatOverlay(BaseObject* creator) 52 : OverlayText(creator) 52 53 { 53 54 RegisterObject(ChatOverlay); 54 55 55 this->displayTime_ = 0 ;56 this->displayTime_ = 0.0; 56 57 57 58 this->setConfigValues(); -
code/branches/objecthierarchy/src/orxonox/overlays/hud/HUDBar.cc
r2019 r2046 46 46 CreateFactory(BarColour); 47 47 48 BarColour::BarColour(BaseObject* creator) : BaseObject(creator), position_(0.0) 48 BarColour::BarColour(BaseObject* creator) 49 : BaseObject(creator) 49 50 { 50 51 RegisterObject(BarColour); 52 53 setColour(ColourValue(1.0, 1.0, 1.0, 1.0)); 54 setPosition(0.0); 51 55 } 52 56 … … 55 59 SUPER(BarColour, XMLPort, xmlElement, mode); 56 60 57 XMLPortParam(BarColour, "colour", setColour, getColour, xmlElement, mode) 58 .defaultValues(ColourValue(1.0, 1.0, 1.0, 1.0)); 59 XMLPortParam(BarColour, "position", setPosition, getPosition, xmlElement, mode).defaultValues(0.0f); 61 XMLPortParam(BarColour, "colour", setColour, getColour, xmlElement, mode); 62 XMLPortParam(BarColour, "position", setPosition, getPosition, xmlElement, mode); 60 63 } 61 64 … … 63 66 unsigned int HUDBar::materialcount_s = 0; 64 67 65 HUDBar::HUDBar(BaseObject* creator) : OrxonoxOverlay(creator), bar_(0), textureUnitState_(0) 68 HUDBar::HUDBar(BaseObject* creator) 69 : OrxonoxOverlay(creator) 66 70 { 67 71 RegisterObject(HUDBar); 72 73 // create new material 74 std::string materialname = "barmaterial" + getConvertedValue<unsigned int, std::string>(materialcount_s++); 75 Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialname, "General"); 76 material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA); 77 this->textureUnitState_ = material->getTechnique(0)->getPass(0)->createTextureUnitState(); 78 this->textureUnitState_->setTextureName("bar2.tga"); 79 // use the default colour 80 this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, ColourValue(0.2, 0.7, 0.2)); 81 82 this->bar_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 83 .createOverlayElement("Panel", "HUDBar_bar_" + getUniqueNumberString())); 84 this->bar_->setMaterialName(materialname); 85 86 setValue(0.4567654f); 87 setRightToLeft(false); 88 setAutoColour(true); 89 90 this->background_->addChild(bar_); 68 91 } 69 92 70 93 HUDBar::~HUDBar() 71 94 { 72 if (this-> bar_)95 if (this->isInitialized()) 73 96 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->bar_); 74 97 } … … 78 101 SUPER(HUDBar, XMLPort, xmlElement, mode); 79 102 80 if (mode == XMLPort::LoadObject) 81 { 82 // create new material 83 std::string materialname = "barmaterial" + getConvertedValue<unsigned int, std::string>(materialcount_s++); 84 Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialname, "General"); 85 material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA); 86 this->textureUnitState_ = material->getTechnique(0)->getPass(0)->createTextureUnitState(); 87 this->textureUnitState_->setTextureName("bar2.tga"); 88 // use the default colour 89 this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, ColourValue(0.2, 0.7, 0.2)); 90 91 this->bar_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 92 .createOverlayElement("Panel", "HUDBar_bar_" + getUniqueNumberString())); 93 this->bar_->setMaterialName(materialname); 94 this->background_->addChild(bar_); 95 } 96 97 XMLPortParam(HUDBar, "initialValue", setValue, getValue, xmlElement, mode).defaultValues(0.4567654f); 98 XMLPortParam(HUDBar, "rightToLeft", setRightToLeft, getRightToLeft, xmlElement, mode).defaultValues(false); 99 XMLPortParam(HUDBar, "autoColour", setAutoColour, getAutoColour, xmlElement, mode).defaultValues(true); 103 XMLPortParam(HUDBar, "initialValue", setValue, getValue, xmlElement, mode); 104 XMLPortParam(HUDBar, "rightToLeft", setRightToLeft, getRightToLeft, xmlElement, mode); 105 XMLPortParam(HUDBar, "autoColour", setAutoColour, getAutoColour, xmlElement, mode); 100 106 XMLPortObject(HUDBar, BarColour, "", addColour, getColour, xmlElement, mode); 101 107 } -
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 -
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 -
code/branches/objecthierarchy/src/orxonox/overlays/hud/HUDSpeedBar.cc
r2019 r2046 36 36 CreateFactory(HUDSpeedBar); 37 37 38 HUDSpeedBar::HUDSpeedBar(BaseObject* creator) : HUDBar(creator) 38 HUDSpeedBar::HUDSpeedBar(BaseObject* creator) 39 : HUDBar(creator) 39 40 { 40 41 RegisterObject(HUDSpeedBar);
Note: See TracChangeset
for help on using the changeset viewer.