Changeset 6067
- Timestamp:
- Nov 15, 2009, 1:44:25 PM (15 years ago)
- Location:
- code/branches/particles2
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/particles2
- Property svn:mergeinfo changed
/code/trunk (added) merged: 6054,6056-6057
- Property svn:mergeinfo changed
-
code/branches/particles2/src/modules/overlays/hud/HUDHealthBar.cc
r5929 r6067 48 48 this->textoverlay_ = new OverlayText(this); 49 49 50 assert(this->textoverlay_ );50 assert(this->textoverlay_.get()); 51 51 52 52 this->textoverlay_->setCaption(""); … … 56 56 { 57 57 if (this->isInitialized()) 58 { 58 59 this->textoverlay_->destroy(); 60 this->textoverlay_ = 0; 61 } 59 62 } 60 63 … … 106 109 SUPER(HUDHealthBar, changedOverlayGroup); 107 110 108 this->getOverlayGroup()->addElement(this->textoverlay_ );111 this->getOverlayGroup()->addElement(this->textoverlay_.get()); 109 112 } 110 113 -
code/branches/particles2/src/modules/overlays/hud/HUDHealthBar.h
r5929 r6067 112 112 private: 113 113 WeakPtr<Pawn> owner_; 114 OverlayText*textoverlay_;114 SmartPtr<OverlayText> textoverlay_; 115 115 bool bUseBarColour_; 116 116 ColourValue textColour_; -
code/branches/particles2/src/modules/overlays/hud/UnderAttackHealthBar.cc
r5929 r6067 34 34 #include "gametypes/UnderAttack.h" 35 35 #include "worldentities/pawns/Destroyer.h" 36 #include "overlays/OverlayGroup.h" 36 37 37 38 namespace orxonox … … 58 59 { 59 60 if (this->isInitialized()) 61 { 60 62 this->text_->destroy(); 63 this->text_ = 0; 64 } 61 65 } 62 66 … … 90 94 } 91 95 } 96 97 void UnderAttackHealthBar::changedOverlayGroup() 98 { 99 SUPER(UnderAttackHealthBar, changedOverlayGroup); 100 101 this->getOverlayGroup()->addElement(this->text_.get()); 102 } 92 103 93 104 void UnderAttackHealthBar::init() -
code/branches/particles2/src/modules/overlays/hud/UnderAttackHealthBar.h
r5929 r6067 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 47 virtual void changedOwner(); 48 virtual void changedOverlayGroup(); 48 49 49 50 inline void setDescriptionPickPoint(const Vector2& pickpoint) … … 61 62 62 63 PlayerInfo* owner_; 63 OverlayText*text_;64 SmartPtr<OverlayText> text_; 64 65 Timer inittimer_; 65 66 }; -
code/branches/particles2/src/orxonox/overlays/OrxonoxOverlay.cc
r5980 r6067 359 359 (*it).second->rotate(angle); 360 360 } 361 362 void OrxonoxOverlay::setOverlayGroup(OverlayGroup* group) 363 { 364 if (group != this->group_) 365 { 366 if (this->group_) 367 this->group_->removeElement(this); 368 this->group_ = group; 369 this->changedOverlayGroup(); 370 } 371 } 361 372 } -
code/branches/particles2/src/orxonox/overlays/OrxonoxOverlay.h
r5980 r6067 169 169 virtual void changedOwner() {} 170 170 171 inline void setOverlayGroup(OverlayGroup* group) 172 { 173 if (group != this->group_) 174 { 175 this->group_ = group; 176 this->changedOverlayGroup(); 177 } 178 } 171 void setOverlayGroup(OverlayGroup* group); 179 172 inline OverlayGroup* getOverlayGroup() const 180 173 { return this->group_; } -
code/branches/particles2/src/orxonox/overlays/OverlayGroup.cc
r5980 r6067 60 60 OverlayGroup::~OverlayGroup() 61 61 { 62 for (std::set< OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)62 for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it) 63 63 (*it)->destroy(); 64 this->hudElements_.clear(); 64 65 } 65 66 … … 83 84 void OverlayGroup::setScale(const Vector2& scale) 84 85 { 85 for (std::set< OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)86 for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it) 86 87 (*it)->scale(scale / this->scale_); 87 88 this->scale_ = scale; … … 91 92 void OverlayGroup::setScroll(const Vector2& scroll) 92 93 { 93 for (std::set< OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)94 for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it) 94 95 (*it)->scroll(scroll - this->scroll_); 95 96 this->scroll_ = scroll; … … 104 105 void OverlayGroup::addElement(OrxonoxOverlay* element) 105 106 { 106 hudElements_.insert( element);107 hudElements_.insert(SmartPtr<OrxonoxOverlay>(element)); 107 108 element->setOverlayGroup( this ); 108 109 if (this->owner_) … … 120 121 bool OverlayGroup::removeElement(OrxonoxOverlay* element) 121 122 { 122 if(this->hudElements_.erase( element) == 0)123 if(this->hudElements_.erase(SmartPtr<OrxonoxOverlay>(element)) == 0) 123 124 return false; 124 125 return true; … … 130 131 if (index < this->hudElements_.size()) 131 132 { 132 std::set< OrxonoxOverlay*>::const_iterator it = hudElements_.begin();133 std::set< SmartPtr<OrxonoxOverlay> >::const_iterator it = hudElements_.begin(); 133 134 for (unsigned int i = 0; i != index; ++it, ++i) 134 135 ; 135 return (*it);136 return it->get(); 136 137 } 137 138 else … … 144 145 SUPER( OverlayGroup, changedVisibility ); 145 146 146 for (std::set< OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)147 for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it) 147 148 (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed 148 149 } … … 152 153 this->owner_ = owner; 153 154 154 for (std::set< OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)155 for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it) 155 156 (*it)->setOwner(owner); 156 157 } -
code/branches/particles2/src/orxonox/overlays/OverlayGroup.h
r5781 r6067 64 64 static void scrollGroup(const std::string& name, const Vector2& scroll); 65 65 66 inline const std::set< OrxonoxOverlay*>& getOverlays() const66 inline const std::set< SmartPtr<OrxonoxOverlay> >& getOverlays() const 67 67 { return this->hudElements_; } 68 68 … … 90 90 91 91 private: 92 std::set< OrxonoxOverlay*> hudElements_; //!< Contains all the OrxonoxOverlays of the this group.92 std::set< SmartPtr<OrxonoxOverlay> > hudElements_; //!< Contains all the OrxonoxOverlays of the this group. 93 93 Vector2 scale_; //!< Current scale (independent of the elements). 94 94 Vector2 scroll_; //!< Current scrolling offset.
Note: See TracChangeset
for help on using the changeset viewer.