Changeset 6067 for code/branches/particles2/src/orxonox/overlays
- Timestamp:
- Nov 15, 2009, 1:44:25 PM (15 years ago)
- Location:
- code/branches/particles2
- Files:
-
- 5 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/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.