Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 19, 2016, 5:04:41 PM (8 years ago)
Author:
sagerj
Message:

done/fixed everything, weaponmode/discharger fully commented only hudchargebar left

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sagerjFS16/src/modules/overlays/hud/HUDChargeBar.h

    r11185 r11189  
    2222 *
    2323 *   Author:
    24  *      Fabian 'x3n' Landau
     24 *      Johannes Sager
    2525 *   Co-authors:
    2626 *      ...
     
    2828 */
    2929
    30 #ifndef _HUDHealthBar_H__
    31 #define _HUDHealthBar_H__
     30#ifndef _HUDChargeBar_H__
     31#define _HUDChargeBar_H__
    3232
    3333#include "overlays/OverlaysPrereqs.h"
    34 
    3534#include "util/Math.h"
    3635#include "tools/interfaces/Tickable.h"
    3736#include "overlays/OverlayText.h"
    3837#include "HUDBar.h"
     38
    3939#include "weaponsystem/WeaponSystem.h"
    4040#include "weaponsystem/WeaponPack.h"
     
    4444namespace orxonox
    4545{
     46    /**
     47    @brief
     48        The HUDChargeBar displays the amount of charges of its owner (a @ref Pawn).
     49        The length of the bar is given by the ratio of the current charges and the maximal charges of the @ref Pawn.
     50    */
     51
    4652    class _OverlaysExport HUDChargeBar : public HUDBar, public Tickable
    4753    {
     
    5056            virtual ~HUDChargeBar();
    5157
    52             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5358            virtual void tick(float dt) override;
    5459            virtual void changedOwner() override;
    55             virtual void changedOverlayGroup() override;
    56             virtual void changedVisibility() override;
    57             virtual void changedName() override;
    58 
    59             inline void setTextFont(const std::string& font)
    60                 { if (!font.empty()) { this->textoverlay_->setFont(font); } }
    61             inline const std::string& getTextFont() const
    62                 { return this->textoverlay_->getFont(); }
    63 
    64             void setTextColour(const ColourValue& colour);
    65             inline const ColourValue& getTextColour() const
    66                 { return this->textoverlay_->getColour(); }
    67 
    68             void setTextUseBarColour(bool bUseBarColour);
    69             inline bool getTextUseBarColour() const
    70                 { return this->bUseBarColour_; }
    71 
    72             inline void setTextAlignment(OverlayText::Alignment alignment)
    73                 { this->textoverlay_->setAlignment(alignment); }
    74             inline OverlayText::Alignment getTextAlignment() const
    75                 { return this->textoverlay_->getAlignment(); }
    76 
    77             void setTextAlignmentString(const std::string& alignment)
    78                 { this->textoverlay_->setAlignmentString(alignment); }
    79             std::string getTextAlignmentString() const
    80                 { return this->textoverlay_->getAlignmentString(); }
    81 
    82             inline void setTextVisible(bool bVisible)
    83                 { this->textoverlay_->setVisible(bVisible); }
    84             inline bool getTextVisible() const
    85                 { return this->textoverlay_->isVisible(); }
    86 
    87             inline void setTextScale(float scale)
    88                 { this->textScale_ = scale;
    89                   positionText();
    90                 }
    91             inline float getTextScale() const
    92                 { return this->textScale_; }
    93 
    94             inline void setTextPickPoint(const Vector2& pickpoint)
    95                 { this->textoverlay_->setPickPoint(pickpoint); }
    96             inline Vector2 getTextPickPoint() const
    97                 { return this->textoverlay_->getPickPoint(); }
    98 
    99             inline void setTextOffset(const Vector2& position)
    100                 { this->textOffset_ = position;
    101                   this->positionText();
    102                 }
    103             inline Vector2 getTextOffset() const
    104                 { return this->textOffset_; }
    105 
    106             inline void setTextRotation(const Degree& angle)
    107                 { this->textoverlay_->setRotation(angle); }
    108             inline const Degree& getTextRotation() const
    109                 { return this->textoverlay_->getRotation(); }
    110 
    111             inline void setTextSpaceWidth(float width)
    112                 { this->textoverlay_->setSpaceWidth(width); }
    113             inline float getTextSpaceWidth() const
    114                 { return this->textoverlay_->getSpaceWidth(); }
    11560
    11661            inline void setHealthBarOwner(Pawn* owner)
    11762                { this->owner_ = owner; }
    118         protected:
    119             virtual void positionChanged() override;
    120             virtual void sizeChanged() override;
     63       
    12164        private:
    122             WeaponMode* correspondingMode_;
    123             void positionText();
     65            WeaponMode* correspondingMode_;         // pointer on the chargeable weaponmode (=nullptr if no chargeable weapons equipped)
    12466            WeakPtr<Pawn> owner_;
    125             StrongPtr<OverlayText> textoverlay_;
    126             bool bUseBarColour_;
    127             ColourValue textColour_;
    128             Vector2 textOffset_;
    129             float textScale_;
    13067    };
    13168}
Note: See TracChangeset for help on using the changeset viewer.