Changeset 1627 for code/trunk/src/orxonox/overlays/hud
- Timestamp:
- Jun 26, 2008, 7:00:59 PM (16 years ago)
- Location:
- code/trunk/src/orxonox/overlays/hud
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/overlays/hud/HUDBar.cc
r1626 r1627 55 55 BaseObject::XMLPort(xmlElement, mode); 56 56 57 XMLPortParam(BarColour, "colour", setColour, getColour, xmlElement, mode); 58 XMLPortParam(BarColour, "position", setPosition, getPosition, xmlElement, mode); 57 if (mode == XMLPort::LoadObject) 58 { 59 this->setColour(ColourValue(1.0, 1.0, 1.0, 1.0)); 60 this->setPosition(0.0f); 61 } 62 63 XMLPortParam(BarColour, "colour", setColour, getColour, xmlElement, mode) 64 .defaultValues(ColourValue(1.0, 1.0, 1.0, 1.0)); 65 XMLPortParam(BarColour, "position", setPosition, getPosition, xmlElement, mode).defaultValues(0.0f); 59 66 } 60 67 … … 90 97 this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, ColourValue(0.2, 0.7, 0.2)); 91 98 92 // create bar93 barWidth_s = 0.88f;94 barHeight_s = 1.0f;95 barOffsetLeft_s = 0.06f;96 barOffsetTop_s = 0.0f;97 98 99 this->bar_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 99 100 .createOverlayElement("Panel", "HUDBar_bar_" + getUniqueNumberStr())); … … 101 102 this->background_->addChild(bar_); 102 103 103 this->setValue(0 );104 this-> autoColour_ = true;105 this-> right2Left_ = false; // default is left to right progress104 this->setValue(0.0f); 105 this->setRightToLeft(false); 106 this->setAutoColour(true); 106 107 } 107 108 108 XMLPortParamLoadOnly(HUDBar, "value", setValue, xmlElement, mode); 109 XMLPortParam(HUDBar, "right2left", setRightToLeft, getRightToLeft, xmlElement, mode); 109 XMLPortParam(HUDBar, "initialValue", setValue, getValue, xmlElement, mode).defaultValues(0.0f); 110 XMLPortParam(HUDBar, "rightToLeft", setRightToLeft, getRightToLeft, xmlElement, mode).defaultValues(false); 111 XMLPortParam(HUDBar, "autoColour", setAutoColour, getAutoColour, xmlElement, mode).defaultValues(true); 110 112 XMLPortObject(HUDBar, BarColour, "", addColour, getColour, xmlElement, mode, false, true); 111 113 } 112 114 113 void HUDBar:: setValue(float value)115 void HUDBar::valueChanged() 114 116 { 115 this->value_ = clamp<float>(value, 0, 1);116 117 if (this->autoColour_ && this->textureUnitState_) 117 118 { … … 153 154 { 154 155 // backward casew 155 this->bar_->setPosition( barOffsetLeft_s + barWidth_s * (1 - this->value_), barOffsetTop_s);156 this->bar_->setDimensions( barWidth_s * this->value_, barHeight_s);156 this->bar_->setPosition(0.06f + 0.88f * (1 - this->value_), 0.0f); 157 this->bar_->setDimensions(0.88f * this->value_, 1.0f); 157 158 } 158 159 else 159 160 { 160 161 // default case 161 this->bar_->setPosition( barOffsetLeft_s, barOffsetTop_s);162 this->bar_->setDimensions( barWidth_s * this->value_, barHeight_s);162 this->bar_->setPosition(0.06f, 0.0f); 163 this->bar_->setDimensions(0.88f * this->value_, 1.0f); 163 164 } 164 165 if (this->value_ != 0) -
code/trunk/src/orxonox/overlays/hud/HUDBar.h
r1626 r1627 60 60 }; 61 61 62 62 63 class _OrxonoxExport HUDBar : public OrxonoxOverlay 63 64 { … … 68 69 virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode); 69 70 70 virtual void setValue(float value);71 71 void clearColours(); 72 72 73 inline void setRightToLeft(bool r2l) 74 { this->right2Left_ = r2l; this->setValue(this->value_); } 75 inline bool getRightToLeft() const 76 { return this->right2Left_; } 77 inline float getValue() const 78 { return this->value_; } 73 void setRightToLeft(bool r2l) { this->right2Left_ = r2l; this->valueChanged(); } 74 bool getRightToLeft() const { return this->right2Left_; } 75 76 void setValue(float value) { this->value_ = clamp(value, 0.0f, 1.0f); this->valueChanged(); } 77 float getValue() const { return this->value_; } 78 79 void setAutoColour(bool val) { this->autoColour_ = val; this->valueChanged(); } 80 bool getAutoColour() const { return this->autoColour_; } 81 82 protected: 83 virtual void valueChanged(); 79 84 80 85 private: … … 91 96 std::vector<BarColour*> barColours_; 92 97 93 float barWidth_s;94 float barHeight_s;95 float barOffsetLeft_s;96 float barOffsetTop_s;97 98 98 static unsigned int materialcount_s; 99 99 }; -
code/trunk/src/orxonox/overlays/hud/HUDNavigation.cc
r1625 r1627 76 76 navText_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton() 77 77 .createOverlayElement("TextArea", "HUDNavigation_navText_" + getUniqueNumberStr())); 78 navText_->setCharHeight(0.05f);79 navText_->setFontName("Monofur");80 78 81 79 // create nav marker … … 83 81 .createOverlayElement("Panel", "HUDNavigation_navMarker_" + getUniqueNumberStr())); 84 82 navMarker_->setMaterialName("Orxonox/NavArrows"); 85 navMarkerSize_ = 0.05; //default86 83 wasOutOfView_ = true; // just to ensure the material is changed right the first time.. 87 84 … … 90 87 .createOverlayElement("Panel", "HUDNavigation_aimMarker_" + getUniqueNumberStr())); 91 88 aimMarker_->setMaterialName("Orxonox/NavCrosshair"); 92 aimMarkerSize_ = 0.04; // default93 89 94 90 background_->addChild(navMarker_); … … 98 94 // hide at first 99 95 this->setVisible(false); 100 } 101 102 XMLPortParam(HUDNavigation, "font", setFont, getFont, xmlElement, mode); 103 XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlElement, mode); 104 XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlElement, mode); 105 XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode); 106 107 if (mode == XMLPort::LoadObject) 108 { 109 this->sizeChanged(); 110 } 96 97 this->setFont("Monofur"); 98 this->setTextSize(0.05f); 99 this->setNavMarkerSize(0.05f); 100 this->setAimMarkerSize(0.04f); 101 } 102 103 XMLPortParam(HUDNavigation, "font", setFont, getFont, xmlElement, mode).defaultValues("Monofur"); 104 XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlElement, mode).defaultValues(0.05f); 105 XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlElement, mode) 106 .defaultValues(0.05f); 107 XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode) 108 .defaultValues(0.04f); 111 109 } 112 110 -
code/trunk/src/orxonox/overlays/hud/HUDNavigation.h
r1625 r1627 54 54 55 55 // XMLPort accessors 56 void setNavMarkerSize(float size) { this->navMarkerSize_ = size; }56 void setNavMarkerSize(float size) { this->navMarkerSize_ = size; this->sizeChanged(); } 57 57 float getNavMarkerSize() const { return this->navMarkerSize_; } 58 58 59 void setAimMarkerSize(float size) { this->aimMarkerSize_ = size; }59 void setAimMarkerSize(float size) { this->aimMarkerSize_ = size; this->sizeChanged(); } 60 60 float getAimMarkerSize() const { return this->aimMarkerSize_; } 61 61 -
code/trunk/src/orxonox/overlays/hud/HUDRadar.cc
r1625 r1627 66 66 void HUDRadar::XMLPort(Element& xmlElement, XMLPort::Mode mode) 67 67 { 68 if (mode == XMLPort::LoadObject)69 this->bCorrectAspect_ = true;70 71 68 OrxonoxOverlay::XMLPort(xmlElement, mode); 72 69 … … 79 76 marker_->hide(); 80 77 81 this->se nsitivity_ = 1.0f;82 this-> halfDotSizeDistance_ = 3000.0f;83 this-> maximumDotSize_ = 0.1;78 this->setRadarSensitivity(1.0f); 79 this->setHalfDotSizeDistance(3000.0f); 80 this->setMaximumDotSize(0.1f); 84 81 } 85 82 86 XMLPortParam(HUDRadar, "sensitivity", setRadarSensitivity, getRadarSensitivity, xmlElement, mode); 87 XMLPortParam(HUDRadar, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, xmlElement, mode); 88 XMLPortParam(HUDRadar, "maximumDotSize", setMaximumDotSize, getMaximumDotSize, xmlElement, mode); 83 XMLPortParam(HUDRadar, "sensitivity", setRadarSensitivity, getRadarSensitivity, xmlElement, mode) 84 .defaultValues(1.0f); 85 XMLPortParam(HUDRadar, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, 86 xmlElement, mode).defaultValues(3000.0f); 87 XMLPortParam(HUDRadar, "maximumDotSize", setMaximumDotSize, getMaximumDotSize, xmlElement, mode) 88 .defaultValues(0.1f); 89 89 90 90 shapeMaterials_[RadarViewable::Dot] = "RadarSquare.tga";
Note: See TracChangeset
for help on using the changeset viewer.