- Timestamp:
- Oct 29, 2015, 11:27:32 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc
r10688 r10721 49 49 RegisterObject(HUDWeaponMode); 50 50 51 weaponIndex_ = 0; 52 weaponModeIndex_ = 0; 53 51 54 overlayElementIcon_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDWeaponMode" + getUniqueNumberString())); 52 55 overlayElementIcon_->setPosition(0.0f,0.0f); … … 80 83 textOverlayLeft_->setPickPoint(Vector2(0.0f,0.0f)); 81 84 textOverlayLeft_->setVisible(true); 82 textOverlayLeft_->setAlignment(OverlayText:: Left);85 textOverlayLeft_->setAlignment(OverlayText::Center); 83 86 textOverlayLeft_->setTextSize(0.02f); 84 87 textOverlayLeft_->setColour(ColourValue(0.21,0.70,0.21,1.0)); 85 textOverlayLeft_->setPosition(getPosition()); 86 textOverlayLeft_->setAspectCorrection(this->getAspectCorrection()); 88 textOverlayLeft_->setAspectCorrection(false); 87 89 88 90 this->textOverlayRight_ = new OverlayText(this->getContext()); … … 91 93 textOverlayRight_->setPickPoint(Vector2(0.0f,0.0f)); 92 94 textOverlayRight_->setVisible(true); 93 textOverlayRight_->setAlignment(OverlayText:: Left);95 textOverlayRight_->setAlignment(OverlayText::Center); 94 96 textOverlayRight_->setTextSize(0.02f); 95 97 textOverlayRight_->setColour(ColourValue(0.21,0.70,0.21,1.0)); 96 textOverlayRight_->setPosition(getPosition()); 97 textOverlayRight_->setAspectCorrection(this->getAspectCorrection()); 98 textOverlayRight_->setAspectCorrection(false); 98 99 99 100 materialNameState_ = "Orxonox/WSHUD_Reloading"; … … 106 107 if (this->isInitialized()) 107 108 { 108 //this->textOverlay_->destroy(); 109 } 109 //this->textOverlay_->destroy(); 110 } 111 } 112 113 void HUDWeaponMode::XMLPort(Element& xmlelement, XMLPort::Mode mode) 114 { 115 SUPER(HUDWeaponMode, XMLPort, xmlelement, mode); 110 116 } 111 117 … … 183 189 184 190 positionHUDChilds(); 185 } 191 } 192 193 void HUDWeaponMode::sizeChanged() 194 { 195 OrxonoxOverlay::sizeChanged(); 196 197 positionHUDChilds(); 198 } 186 199 187 200 void HUDWeaponMode::changedOwner() … … 190 203 191 204 this->owner_ = orxonox_cast<Pawn*>(this->getOwner()); 192 193 //updateWeaponsList();194 205 } 195 206 … … 206 217 SUPER(HUDWeaponMode, changedVisibility); 207 218 208 //this->textOverlay_->setVisible(this->isVisible()); 219 this->textOverlayLeft_->setVisible(this->isVisible()); 220 this->textOverlayRight_->setVisible(this->isVisible()); 209 221 } 210 222 … … 248 260 overlayElementMunition_->setMaterialName("Orxonox/WSHUD_MunitionSeparate"); 249 261 } 250 } 262 } 251 263 } 252 264 253 265 void HUDWeaponMode::positionHUDChilds() 254 266 { 255 textOverlayLeft_->setPosition(getPosition() + Vector2(0.06f,0.0f)); 256 textOverlayRight_->setPosition(getPosition() + Vector2(0.105f,0.0f)); 257 } 267 Vector2 size = Vector2(getSize().x*45.0f/150.0f, getSize().y); 268 Vector2 offset1 = Vector2(getSize().x*82.5f/150.0f, 0.0f); 269 Vector2 offset2 = Vector2(getSize().x*127.5f/150.0f, 0.0f); 270 271 textOverlayLeft_->setPosition(getPosition() + offset1); 272 textOverlayRight_->setPosition(getPosition() + offset2); 273 274 textOverlayLeft_->setSize(size); 275 textOverlayRight_->setSize(size); 276 277 textOverlayLeft_->setTextSize(getSize().y); 278 textOverlayRight_->setTextSize(getSize().y); 279 } 280 281 void HUDWeaponMode::updateSize() 282 { 283 this->setSize(weaponModeHUDActualSize_); 284 updatePosition(); 285 } 286 287 void HUDWeaponMode::updatePosition() 288 { 289 this->setPosition(Vector2(weaponModeHUDActualSize_.x*weaponIndex_,weaponModeHUDActualSize_.y*weaponModeIndex_)); 290 } 258 291 }
Note: See TracChangeset
for help on using the changeset viewer.