Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 13, 2009, 5:05:17 PM (15 years ago)
Author:
dafrick
Message:

Hopefully merged trunk successfully into pickup branch.

Location:
code/branches/pickup
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup

  • code/branches/pickup/src/modules/overlays/FadeoutText.cc

    r5781 r5935  
    4646
    4747        this->bFadingOut_ = false;
    48         this->fadeouttimer_.setTimer(3.0f, false, this, createExecutor(createFunctor(&FadeoutText::fadeout)));
     48        this->fadeouttimer_.setTimer(3.0f, false, createExecutor(createFunctor(&FadeoutText::fadeout, this)));
    4949        this->fadeouttimer_.stopTimer();
    5050
  • code/branches/pickup/src/modules/overlays/FadeoutText.h

    r5781 r5935  
    6868
    6969            bool bFadingOut_;
    70             Timer<FadeoutText> fadeouttimer_;
     70            Timer fadeouttimer_;
    7171
    7272            float initialAlpha_;
  • code/branches/pickup/src/modules/overlays/OverlaysPrereqs.h

    r5781 r5935  
    2828
    2929/**
    30   @file
    31   @brief Contains all the necessary forward declarations for all classes and structs.
     30@file
     31@brief
     32    Shared library macros, enums, constants and forward declarations for the overlays module
    3233*/
    3334
     
    3637
    3738#include "OrxonoxConfig.h"
     39#include "OrxonoxPrereqs.h"
    3840
    3941//-----------------------------------------------------------------------
    4042// Shared library settings
    4143//-----------------------------------------------------------------------
     44
    4245#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
    4346#  ifdef OVERLAYS_SHARED_BUILD
     
    6265namespace orxonox
    6366{
    64     class BarColour;
     67    class FadeoutText;
     68    class GUIOverlay;
     69    class OverlayText;
     70
     71    // debugging
    6572    class DebugFPSText;
    6673    class DebugRTRText;
    67     class GUIOverlay;
     74
     75    // hud
     76    class AnnounceMessage;
     77    class BarColour;
     78    class ChatOverlay;
     79    class DeathMessage;
     80    class GametypeStatus;
    6881    class HUDBar;
     82    class HUDHealthBar;
    6983    class HUDNavigation;
    7084    class HUDRadar;
    7185    class HUDSpeedBar;
    72     class HUDHealthBar;
    7386    class HUDTimer;
    74     class OrxonoxOverlay;
    75     class OverlayGroup;
    76     class OverlayText;
    77     class FadeoutText;
    78     class GametypeStatus;
    79     class AnnounceMessage;
    8087    class KillMessage;
    81     class DeathMessage;
     88    class TeamBaseMatchScore;
     89    class UnderAttackHealthBar;
    8290
     91    // stats
    8392    class CreateLines;
    8493    class Scoreboard;
  • code/branches/pickup/src/modules/overlays/hud/ChatOverlay.cc

    r5781 r5935  
    5858    ChatOverlay::~ChatOverlay()
    5959    {
     60        for (std::set<Timer*>::iterator it = this->timers_.begin(); it != this->timers_.end(); ++it)
     61            delete (*it);
    6062    }
    6163
     
    8789        COUT(0) << "Chat: " << text << std::endl;
    8890
    89         new Timer<ChatOverlay>(this->displayTime_, false, this, createExecutor(createFunctor(&ChatOverlay::dropMessage)), true);
     91        Timer* timer = new Timer();
     92        this->timers_.insert(timer); // store the timer in a set to destroy it in the destructor
     93        Executor* executor = createExecutor(createFunctor(&ChatOverlay::dropMessage, this));
     94        executor->setDefaultValues(timer);
     95        timer->setTimer(this->displayTime_, false, executor, true);
    9096
    9197        this->updateOverlayText();
    9298    }
    9399
    94     void ChatOverlay::dropMessage()
     100    void ChatOverlay::dropMessage(Timer* timer)
    95101    {
    96102        if (this->messages_.size() > 0)
    97103            this->messages_.pop_front();
    98104        this->updateOverlayText();
     105        this->timers_.erase(timer); // the timer destroys itself, but we have to remove it from the set
    99106    }
    100107
  • code/branches/pickup/src/modules/overlays/hud/ChatOverlay.h

    r5781 r5935  
    5555        private:
    5656            void updateOverlayText();
    57             void dropMessage();
     57            void dropMessage(Timer* timer);
    5858
    5959            float displayTime_;
     60            std::set<Timer*> timers_;
    6061    };
    6162}
  • code/branches/pickup/src/modules/overlays/hud/HUDBar.cc

    r5781 r5935  
    9696    {
    9797        if (this->isInitialized())
     98        {
    9899            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->bar_);
     100            for (std::vector<BarColour*>::const_iterator it = this->barColours_.begin(); it != this->barColours_.end(); )
     101                (*it++)->destroy();
     102        }
    99103    }
    100104
  • code/branches/pickup/src/modules/overlays/hud/HUDHealthBar.cc

    r5781 r5935  
    5656    {
    5757        if (this->isInitialized())
    58             delete this->textoverlay_;
     58            this->textoverlay_->destroy();
    5959    }
    6060
     
    8484            this->setValue(this->owner_->getHealth() / this->owner_->getInitialHealth());
    8585            this->textoverlay_->setCaption(multi_cast<std::string>(static_cast<int>(this->owner_->getHealth())));
     86        }
     87        else
     88        {
     89            this->setValue(0);
     90            this->textoverlay_->setCaption("0");
    8691        }
    8792
  • code/branches/pickup/src/modules/overlays/hud/HUDHealthBar.h

    r5781 r5935  
    111111
    112112        private:
    113             Pawn* owner_;
     113            WeakPtr<Pawn> owner_;
    114114            OverlayText* textoverlay_;
    115115            bool bUseBarColour_;
  • code/branches/pickup/src/modules/overlays/hud/HUDNavigation.cc

    r5781 r5935  
    3939#include "core/CoreIncludes.h"
    4040#include "core/XMLPort.h"
     41#include "Scene.h"
    4142#include "Radar.h"
    4243
     
    130131        SUPER(HUDNavigation, tick, dt);
    131132
    132         if (!Radar::getInstance().getFocus())
     133        // Get radar
     134        Radar* radar = this->getOwner()->getScene()->getRadar();
     135
     136        if (!radar->getFocus())
    133137        {
    134138            this->overlay_->hide();
     
    150154*/
    151155        // transform to screen coordinates
    152         Vector3 pos = /*transformationMatrix * */Radar::getInstance().getFocus()->getRVWorldPosition();
     156        Vector3 pos = /*transformationMatrix * */radar->getFocus()->getRVWorldPosition();
    153157
    154158        bool outOfView;
  • code/branches/pickup/src/modules/overlays/hud/TeamBaseMatchScore.cc

    r5781 r5935  
    118118
    119119        if (this->getOwner() && this->getOwner()->getGametype())
    120             this->owner_ = orxonox_cast<TeamBaseMatch*>(this->getOwner()->getGametype());
     120            this->owner_ = orxonox_cast<TeamBaseMatch*>(this->getOwner()->getGametype().get());
    121121        else
    122122            this->owner_ = 0;
  • code/branches/pickup/src/modules/overlays/hud/UnderAttackHealthBar.cc

    r5781 r5935  
    5252        this->text_->setPickPoint(Vector2(0.5, 0));
    5353
    54         this->inittimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&UnderAttackHealthBar::init)));
     54        this->inittimer_.setTimer(0.0f, false, createExecutor(createFunctor(&UnderAttackHealthBar::init, this)));
    5555    }
    5656
     
    5858    {
    5959        if (this->isInitialized())
    60             delete this->text_;
     60            this->text_->destroy();
    6161    }
    6262
     
    7878            this->owner_ = player;
    7979
    80             UnderAttack* ua = orxonox_cast<UnderAttack*>(player->getGametype());
     80            UnderAttack* ua = orxonox_cast<UnderAttack*>(player->getGametype().get());
    8181            if (ua)
    8282            {
  • code/branches/pickup/src/modules/overlays/hud/UnderAttackHealthBar.h

    r5781 r5935  
    6262            PlayerInfo* owner_;
    6363            OverlayText* text_;
    64             Timer<UnderAttackHealthBar> inittimer_;
     64            Timer inittimer_;
    6565    };
    6666}
  • code/branches/pickup/src/modules/overlays/stats/CreateLines.cc

    r5781 r5935  
    5959    CreateLines::~CreateLines()
    6060    {
    61         delete this->playerNameText_;
    62         delete this->scoreText_;
    63         delete this->deathsText_;
    64         delete this->background_;
     61        this->playerNameText_->destroy();
     62        this->scoreText_->destroy();
     63        this->deathsText_->destroy();
     64        this->background_->destroy();
    6565    }
    6666
  • code/branches/pickup/src/modules/overlays/stats/Scoreboard.cc

    r5781 r5935  
    4444    {
    4545        RegisterObject(Scoreboard);
     46    }
     47
     48    Scoreboard::~Scoreboard()
     49    {
     50        while (this->lines_.size() > 0)
     51        {
     52            // destroy lines
     53            delete this->lines_.back();
     54            this->lines_.pop_back();
     55        }
    4656    }
    4757
  • code/branches/pickup/src/modules/overlays/stats/Scoreboard.h

    r5781 r5935  
    4242    public: // functions
    4343        Scoreboard(BaseObject* creator);
    44         virtual ~Scoreboard() {}
     44        virtual ~Scoreboard();
    4545
    4646        virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
Note: See TracChangeset for help on using the changeset viewer.