Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5980


Ignore:
Timestamp:
Oct 21, 2009, 4:06:50 PM (15 years ago)
Author:
scheusso
Message:

fixed a logical error in OverlayGroup/OrxonoxOverlay (visibility of overlays in a overlaygroup could not be configured individually)
changed Scoreboard/CreateLines accordingly
set initial visibility of QuestGUI to false

Location:
code/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/data/overlays/hudtemplates3.oxo

    r5781 r5980  
    9999      name = "QuestGUI"
    100100      guiname = "QuestGUI"
     101      visible = "false"
    101102    />
    102103
  • code/trunk/src/modules/overlays/GUIOverlay.cc

    r5978 r5980  
    6262    {
    6363        SUPER(GUIOverlay, changedVisibility);
    64 
     64       
    6565        //Setting player now.
    66         GUIManager::getInstance().setPlayer(this->guiName_, (orxonox_cast<ControllableEntity*>(this->getOwner()))->getPlayer());
     66        if( this->getOwner() )
     67            GUIManager::getInstance().setPlayer(this->guiName_, (orxonox_cast<ControllableEntity*>(this->getOwner()))->getPlayer());
    6768
    6869        if (this->isVisible())
  • code/trunk/src/modules/overlays/stats/CreateLines.cc

    r5929 r5980  
    8787        this->background_->setVisible(visible);
    8888    }
     89    void CreateLines::changedVisibility()
     90    {
     91        this->scoreText_->changedVisibility();
     92        this->deathsText_->changedVisibility();
     93        this->playerNameText_->changedVisibility();
     94        this->background_->changedVisibility();
     95    }
     96   
     97    void CreateLines::setOverlayGroup( OverlayGroup* group )
     98    {
     99        this->scoreText_->setOverlayGroup( group );
     100        this->deathsText_->setOverlayGroup( group );
     101        this->playerNameText_->setOverlayGroup( group );
     102        this->background_->setOverlayGroup( group );
     103    }
    89104
    90105    /**
  • code/trunk/src/modules/overlays/stats/CreateLines.h

    r5781 r5980  
    4444
    4545        void setVisibility(bool);
     46        void changedVisibility();
     47        void setOverlayGroup( OverlayGroup* group );
    4648
    4749        //void setNumberOfColumns(unsigned int numberOfColumns, unsigned int lineIndex);
  • code/trunk/src/modules/overlays/stats/Scoreboard.cc

    r5929 r5980  
    6969
    7070        for (unsigned int i = 0; i < this->lines_.size(); ++i)
    71             this->lines_[i]->setVisibility(this->isVisible());
     71            this->lines_[i]->changedVisibility();
    7272    }
    7373
     
    8989            CreateLines* lines = new CreateLines(leftOffset, topOffset + (distance + height) * lines_.size(), width, height);
    9090            lines->setVisibility(this->isVisible());
     91            lines->setOverlayGroup( this->getOverlayGroup() );
    9192            this->lines_.push_back(lines);
    9293        }
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc

    r5781 r5980  
    4848#include "core/ConsoleCommand.h"
    4949
     50#include "OverlayGroup.h"
     51
    5052namespace orxonox
    5153{
     
    165167    void OrxonoxOverlay::changedVisibility()
    166168    {
     169        SUPER( OrxonoxOverlay, changedVisibility );
     170       
    167171        if (!this->overlay_)
    168172            return;
    169173
    170         if (this->isVisible())
     174        // only set to visible if corresponding OverlayGroup is also visible
     175        if (this->isVisible() && (!this->getOverlayGroup() || this->getOverlayGroup()->isVisible()) )
    171176            this->overlay_->show();
    172177        else
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.h

    r5929 r5980  
    179179        inline OverlayGroup* getOverlayGroup() const
    180180            { return this->group_; }
    181         virtual void changedOverlayGroup() {}
     181        virtual void changedOverlayGroup()
     182            { this->changedVisibility(); }
    182183
    183184    protected:
  • code/trunk/src/orxonox/overlays/OverlayGroup.cc

    r5929 r5980  
    105105    {
    106106        hudElements_.insert(element);
    107         element->setVisible(this->isVisible());
     107        element->setOverlayGroup( this );
    108108        if (this->owner_)
    109109            element->setOwner(this->owner_);
     
    142142    void OverlayGroup::changedVisibility()
    143143    {
    144         for (std::set<OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    145             (*it)->setVisible(this->isVisible());
     144        SUPER( OverlayGroup, changedVisibility );
     145       
     146        for (std::set<OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
     147            (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed
    146148    }
    147149
Note: See TracChangeset for help on using the changeset viewer.