[Orxonox-commit 1349] r6067 - in code/branches/particles2: . src/modules/overlays/hud src/orxonox/overlays
rgrieder at orxonox.net
rgrieder at orxonox.net
Sun Nov 15 13:44:25 CET 2009
Author: rgrieder
Date: 2009-11-15 13:44:25 +0100 (Sun, 15 Nov 2009)
New Revision: 6067
Modified:
code/branches/particles2/
code/branches/particles2/src/modules/overlays/hud/HUDHealthBar.cc
code/branches/particles2/src/modules/overlays/hud/HUDHealthBar.h
code/branches/particles2/src/modules/overlays/hud/UnderAttackHealthBar.cc
code/branches/particles2/src/modules/overlays/hud/UnderAttackHealthBar.h
code/branches/particles2/src/orxonox/overlays/OrxonoxOverlay.cc
code/branches/particles2/src/orxonox/overlays/OrxonoxOverlay.h
code/branches/particles2/src/orxonox/overlays/OverlayGroup.cc
code/branches/particles2/src/orxonox/overlays/OverlayGroup.h
Log:
Merged revisions 6054, 6056 and 6057 to particles2 branch.
Property changes on: code/branches/particles2
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/core5:5768-5928
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/resource2:3372-5694
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
code/branches/core3:1572-1739
code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
code/branches/miniprojects:2754-2824
code/branches/netp2:2835-2988
code/branches/netp3:2988-3082
code/branches/netp6:3214-3302
code/branches/network:2356
code/branches/network64:2210-2355
code/branches/objecthierarchy:1911-2085,2100,2110-2169
code/branches/objecthierarchy2:2171-2479
code/branches/overlay:2117-2385
code/branches/particles:2829-3085
code/branches/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890
+ /code/branches/core5:5768-5928
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/resource2:3372-5694
/code/trunk:6054-6057
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
code/branches/core3:1572-1739
code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
code/branches/miniprojects:2754-2824
code/branches/netp2:2835-2988
code/branches/netp3:2988-3082
code/branches/netp6:3214-3302
code/branches/network:2356
code/branches/network64:2210-2355
code/branches/objecthierarchy:1911-2085,2100,2110-2169
code/branches/objecthierarchy2:2171-2479
code/branches/overlay:2117-2385
code/branches/particles:2829-3085
code/branches/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890
Modified: code/branches/particles2/src/modules/overlays/hud/HUDHealthBar.cc
===================================================================
--- code/branches/particles2/src/modules/overlays/hud/HUDHealthBar.cc 2009-11-15 12:37:45 UTC (rev 6066)
+++ code/branches/particles2/src/modules/overlays/hud/HUDHealthBar.cc 2009-11-15 12:44:25 UTC (rev 6067)
@@ -47,7 +47,7 @@
this->textoverlay_ = new OverlayText(this);
- assert(this->textoverlay_);
+ assert(this->textoverlay_.get());
this->textoverlay_->setCaption("");
}
@@ -55,7 +55,10 @@
HUDHealthBar::~HUDHealthBar()
{
if (this->isInitialized())
+ {
this->textoverlay_->destroy();
+ this->textoverlay_ = 0;
+ }
}
void HUDHealthBar::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -105,7 +108,7 @@
{
SUPER(HUDHealthBar, changedOverlayGroup);
- this->getOverlayGroup()->addElement(this->textoverlay_);
+ this->getOverlayGroup()->addElement(this->textoverlay_.get());
}
void HUDHealthBar::changedVisibility()
Modified: code/branches/particles2/src/modules/overlays/hud/HUDHealthBar.h
===================================================================
--- code/branches/particles2/src/modules/overlays/hud/HUDHealthBar.h 2009-11-15 12:37:45 UTC (rev 6066)
+++ code/branches/particles2/src/modules/overlays/hud/HUDHealthBar.h 2009-11-15 12:44:25 UTC (rev 6067)
@@ -111,7 +111,7 @@
private:
WeakPtr<Pawn> owner_;
- OverlayText* textoverlay_;
+ SmartPtr<OverlayText> textoverlay_;
bool bUseBarColour_;
ColourValue textColour_;
};
Modified: code/branches/particles2/src/modules/overlays/hud/UnderAttackHealthBar.cc
===================================================================
--- code/branches/particles2/src/modules/overlays/hud/UnderAttackHealthBar.cc 2009-11-15 12:37:45 UTC (rev 6066)
+++ code/branches/particles2/src/modules/overlays/hud/UnderAttackHealthBar.cc 2009-11-15 12:44:25 UTC (rev 6067)
@@ -33,6 +33,7 @@
#include "infos/PlayerInfo.h"
#include "gametypes/UnderAttack.h"
#include "worldentities/pawns/Destroyer.h"
+#include "overlays/OverlayGroup.h"
namespace orxonox
{
@@ -57,7 +58,10 @@
UnderAttackHealthBar::~UnderAttackHealthBar()
{
if (this->isInitialized())
+ {
this->text_->destroy();
+ this->text_ = 0;
+ }
}
void UnderAttackHealthBar::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -89,6 +93,13 @@
}
}
}
+
+ void UnderAttackHealthBar::changedOverlayGroup()
+ {
+ SUPER(UnderAttackHealthBar, changedOverlayGroup);
+
+ this->getOverlayGroup()->addElement(this->text_.get());
+ }
void UnderAttackHealthBar::init()
{
Modified: code/branches/particles2/src/modules/overlays/hud/UnderAttackHealthBar.h
===================================================================
--- code/branches/particles2/src/modules/overlays/hud/UnderAttackHealthBar.h 2009-11-15 12:37:45 UTC (rev 6066)
+++ code/branches/particles2/src/modules/overlays/hud/UnderAttackHealthBar.h 2009-11-15 12:44:25 UTC (rev 6067)
@@ -45,6 +45,7 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
virtual void changedOwner();
+ virtual void changedOverlayGroup();
inline void setDescriptionPickPoint(const Vector2& pickpoint)
{ this->text_->setPickPoint(pickpoint); }
@@ -60,7 +61,7 @@
void init();
PlayerInfo* owner_;
- OverlayText* text_;
+ SmartPtr<OverlayText> text_;
Timer inittimer_;
};
}
Modified: code/branches/particles2/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/branches/particles2/src/orxonox/overlays/OrxonoxOverlay.cc 2009-11-15 12:37:45 UTC (rev 6066)
+++ code/branches/particles2/src/orxonox/overlays/OrxonoxOverlay.cc 2009-11-15 12:44:25 UTC (rev 6067)
@@ -358,4 +358,15 @@
if (it != overlays_s.end())
(*it).second->rotate(angle);
}
+
+ void OrxonoxOverlay::setOverlayGroup(OverlayGroup* group)
+ {
+ if (group != this->group_)
+ {
+ if (this->group_)
+ this->group_->removeElement(this);
+ this->group_ = group;
+ this->changedOverlayGroup();
+ }
+ }
}
Modified: code/branches/particles2/src/orxonox/overlays/OrxonoxOverlay.h
===================================================================
--- code/branches/particles2/src/orxonox/overlays/OrxonoxOverlay.h 2009-11-15 12:37:45 UTC (rev 6066)
+++ code/branches/particles2/src/orxonox/overlays/OrxonoxOverlay.h 2009-11-15 12:44:25 UTC (rev 6067)
@@ -168,14 +168,7 @@
{ return this->owner_; }
virtual void changedOwner() {}
- inline void setOverlayGroup(OverlayGroup* group)
- {
- if (group != this->group_)
- {
- this->group_ = group;
- this->changedOverlayGroup();
- }
- }
+ void setOverlayGroup(OverlayGroup* group);
inline OverlayGroup* getOverlayGroup() const
{ return this->group_; }
virtual void changedOverlayGroup()
Modified: code/branches/particles2/src/orxonox/overlays/OverlayGroup.cc
===================================================================
--- code/branches/particles2/src/orxonox/overlays/OverlayGroup.cc 2009-11-15 12:37:45 UTC (rev 6066)
+++ code/branches/particles2/src/orxonox/overlays/OverlayGroup.cc 2009-11-15 12:44:25 UTC (rev 6067)
@@ -59,8 +59,9 @@
OverlayGroup::~OverlayGroup()
{
- for (std::set<OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+ for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
(*it)->destroy();
+ this->hudElements_.clear();
}
/**
@@ -82,7 +83,7 @@
//! Scales every element in the set.
void OverlayGroup::setScale(const Vector2& scale)
{
- for (std::set<OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+ for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
(*it)->scale(scale / this->scale_);
this->scale_ = scale;
}
@@ -90,7 +91,7 @@
//! Scrolls every element in the set.
void OverlayGroup::setScroll(const Vector2& scroll)
{
- for (std::set<OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+ for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
(*it)->scroll(scroll - this->scroll_);
this->scroll_ = scroll;
}
@@ -103,7 +104,7 @@
*/
void OverlayGroup::addElement(OrxonoxOverlay* element)
{
- hudElements_.insert(element);
+ hudElements_.insert(SmartPtr<OrxonoxOverlay>(element));
element->setOverlayGroup( this );
if (this->owner_)
element->setOwner(this->owner_);
@@ -119,7 +120,7 @@
*/
bool OverlayGroup::removeElement(OrxonoxOverlay* element)
{
- if(this->hudElements_.erase(element) == 0)
+ if(this->hudElements_.erase(SmartPtr<OrxonoxOverlay>(element)) == 0)
return false;
return true;
}
@@ -129,10 +130,10 @@
{
if (index < this->hudElements_.size())
{
- std::set<OrxonoxOverlay*>::const_iterator it = hudElements_.begin();
+ std::set< SmartPtr<OrxonoxOverlay> >::const_iterator it = hudElements_.begin();
for (unsigned int i = 0; i != index; ++it, ++i)
;
- return (*it);
+ return it->get();
}
else
return 0;
@@ -143,7 +144,7 @@
{
SUPER( OverlayGroup, changedVisibility );
- for (std::set<OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+ for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
(*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed
}
@@ -151,7 +152,7 @@
{
this->owner_ = owner;
- for (std::set<OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+ for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
(*it)->setOwner(owner);
}
Modified: code/branches/particles2/src/orxonox/overlays/OverlayGroup.h
===================================================================
--- code/branches/particles2/src/orxonox/overlays/OverlayGroup.h 2009-11-15 12:37:45 UTC (rev 6066)
+++ code/branches/particles2/src/orxonox/overlays/OverlayGroup.h 2009-11-15 12:44:25 UTC (rev 6067)
@@ -63,7 +63,7 @@
static void scaleGroup(const std::string& name, float scale);
static void scrollGroup(const std::string& name, const Vector2& scroll);
- inline const std::set<OrxonoxOverlay*>& getOverlays() const
+ inline const std::set< SmartPtr<OrxonoxOverlay> >& getOverlays() const
{ return this->hudElements_; }
void changedVisibility();
@@ -89,7 +89,7 @@
OrxonoxOverlay* getElement(unsigned int index);
private:
- std::set<OrxonoxOverlay*> hudElements_; //!< Contains all the OrxonoxOverlays of the this group.
+ std::set< SmartPtr<OrxonoxOverlay> > hudElements_; //!< Contains all the OrxonoxOverlays of the this group.
Vector2 scale_; //!< Current scale (independent of the elements).
Vector2 scroll_; //!< Current scrolling offset.
BaseObject* owner_; //!< The owner of this OverlayGroup
More information about the Orxonox-commit
mailing list