- Timestamp:
- May 19, 2016, 5:04:41 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sagerjFS16/src/modules/overlays/hud/HUDChargeBar.h
r11185 r11189 22 22 * 23 23 * Author: 24 * Fabian 'x3n' Landau24 * Johannes Sager 25 25 * Co-authors: 26 26 * ... … … 28 28 */ 29 29 30 #ifndef _HUD HealthBar_H__31 #define _HUD HealthBar_H__30 #ifndef _HUDChargeBar_H__ 31 #define _HUDChargeBar_H__ 32 32 33 33 #include "overlays/OverlaysPrereqs.h" 34 35 34 #include "util/Math.h" 36 35 #include "tools/interfaces/Tickable.h" 37 36 #include "overlays/OverlayText.h" 38 37 #include "HUDBar.h" 38 39 39 #include "weaponsystem/WeaponSystem.h" 40 40 #include "weaponsystem/WeaponPack.h" … … 44 44 namespace orxonox 45 45 { 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 46 52 class _OverlaysExport HUDChargeBar : public HUDBar, public Tickable 47 53 { … … 50 56 virtual ~HUDChargeBar(); 51 57 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;53 58 virtual void tick(float dt) override; 54 59 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() const62 { return this->textoverlay_->getFont(); }63 64 void setTextColour(const ColourValue& colour);65 inline const ColourValue& getTextColour() const66 { return this->textoverlay_->getColour(); }67 68 void setTextUseBarColour(bool bUseBarColour);69 inline bool getTextUseBarColour() const70 { return this->bUseBarColour_; }71 72 inline void setTextAlignment(OverlayText::Alignment alignment)73 { this->textoverlay_->setAlignment(alignment); }74 inline OverlayText::Alignment getTextAlignment() const75 { return this->textoverlay_->getAlignment(); }76 77 void setTextAlignmentString(const std::string& alignment)78 { this->textoverlay_->setAlignmentString(alignment); }79 std::string getTextAlignmentString() const80 { return this->textoverlay_->getAlignmentString(); }81 82 inline void setTextVisible(bool bVisible)83 { this->textoverlay_->setVisible(bVisible); }84 inline bool getTextVisible() const85 { return this->textoverlay_->isVisible(); }86 87 inline void setTextScale(float scale)88 { this->textScale_ = scale;89 positionText();90 }91 inline float getTextScale() const92 { return this->textScale_; }93 94 inline void setTextPickPoint(const Vector2& pickpoint)95 { this->textoverlay_->setPickPoint(pickpoint); }96 inline Vector2 getTextPickPoint() const97 { return this->textoverlay_->getPickPoint(); }98 99 inline void setTextOffset(const Vector2& position)100 { this->textOffset_ = position;101 this->positionText();102 }103 inline Vector2 getTextOffset() const104 { return this->textOffset_; }105 106 inline void setTextRotation(const Degree& angle)107 { this->textoverlay_->setRotation(angle); }108 inline const Degree& getTextRotation() const109 { return this->textoverlay_->getRotation(); }110 111 inline void setTextSpaceWidth(float width)112 { this->textoverlay_->setSpaceWidth(width); }113 inline float getTextSpaceWidth() const114 { return this->textoverlay_->getSpaceWidth(); }115 60 116 61 inline void setHealthBarOwner(Pawn* owner) 117 62 { this->owner_ = owner; } 118 protected: 119 virtual void positionChanged() override; 120 virtual void sizeChanged() override; 63 121 64 private: 122 WeaponMode* correspondingMode_; 123 void positionText(); 65 WeaponMode* correspondingMode_; // pointer on the chargeable weaponmode (=nullptr if no chargeable weapons equipped) 124 66 WeakPtr<Pawn> owner_; 125 StrongPtr<OverlayText> textoverlay_;126 bool bUseBarColour_;127 ColourValue textColour_;128 Vector2 textOffset_;129 float textScale_;130 67 }; 131 68 }
Note: See TracChangeset
for help on using the changeset viewer.