Changeset 6054 for code/trunk/src/orxonox/overlays
- Timestamp:
- Nov 13, 2009, 11:12:31 AM (15 years ago)
- Location:
- code/trunk/src/orxonox/overlays
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/overlays/OverlayGroup.cc
r5980 r6054 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/trunk/src/orxonox/overlays/OverlayGroup.h
r5781 r6054 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.