Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/dynamicmatch/src/modules/overlays/hud/HUDHealthBar.h @ 6584

Last change on this file since 6584 was 6417, checked in by rgrieder, 15 years ago

Merged presentation2 branch back to trunk.
Major new features:

  • Actual GUI with settings, etc.
  • Improved space ship steering (human interaction)
  • Rocket fire and more particle effects
  • Advanced sound framework
  • Property svn:eol-style set to native
File size: 4.7 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _HUDHealthBar_H__
30#define _HUDHealthBar_H__
31
32#include "overlays/OverlaysPrereqs.h"
33
34#include "util/Math.h"
35#include "tools/interfaces/Tickable.h"
36#include "overlays/OverlayText.h"
37#include "HUDBar.h"
38
39namespace orxonox
40{
41    class _OverlaysExport HUDHealthBar : public HUDBar, public Tickable
42    {
43        public:
44            HUDHealthBar(BaseObject* creator);
45            virtual ~HUDHealthBar();
46
47            virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
48            virtual void tick(float dt);
49            virtual void changedOwner();
50            virtual void changedOverlayGroup();
51            virtual void changedVisibility();
52            virtual void changedName();
53
54            inline void setTextFont(const std::string& font)
55                { if (!font.empty()) { this->textoverlay_->setFont(font); } }
56            inline const std::string& getTextFont() const
57                { return this->textoverlay_->getFont(); }
58
59            void setTextColour(const ColourValue& colour);
60            inline const ColourValue& getTextColour() const
61                { return this->textoverlay_->getColour(); }
62
63            void setTextUseBarColour(bool bUseBarColour);
64            inline bool getTextUseBarColour() const
65                { return this->bUseBarColour_; }
66
67            inline void setTextAlignment(OverlayText::Alignment alignment)
68                { this->textoverlay_->setAlignment(alignment); }
69            inline OverlayText::Alignment getTextAlignment() const
70                { return this->textoverlay_->getAlignment(); }
71
72            void setTextAlignmentString(const std::string& alignment)
73                { this->textoverlay_->setAlignmentString(alignment); }
74            std::string getTextAlignmentString() const
75                { return this->textoverlay_->getAlignmentString(); }
76
77            inline void setTextSize(float size)
78                { this->textoverlay_->setTextSize(size); }
79            inline float getTextSize() const
80                { return this->textoverlay_->getTextSize(); }
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 setTextPickPoint(const Vector2& pickpoint)
88                { this->textoverlay_->setPickPoint(pickpoint); }
89            inline Vector2 getTextPickPoint() const
90                { return this->textoverlay_->getPickPoint(); }
91
92            inline void setTextOffset(const Vector2& position)
93                { this->textoverlay_->setPosition(this->getPosition() + (position - this->getPickPoint()) * this->getSize()); }
94            inline Vector2 getTextOffset() const
95                { return (this->textoverlay_->getPosition() - this->getPosition()) / this->getSize() + this->getPickPoint(); }
96
97            inline void setTextAspectCorrection(bool correct)
98                { this->textoverlay_->setAspectCorrection(correct); }
99            inline bool getTextAspectCorrection() const
100                { return this->textoverlay_->getAspectCorrection(); }
101
102            inline void setTextRotation(const Degree& angle)
103                { this->textoverlay_->setRotation(angle); }
104            inline const Degree& getTextRotation() const
105                { return this->textoverlay_->getRotation(); }
106
107            inline void setTextSpaceWidth(float width)
108                { this->textoverlay_->setSpaceWidth(width); }
109            inline float getTextSpaceWidth() const
110                { return this->textoverlay_->getSpaceWidth(); }
111
112        private:
113            WeakPtr<Pawn> owner_;
114            SmartPtr<OverlayText> textoverlay_;
115            bool bUseBarColour_;
116            ColourValue textColour_;
117    };
118}
119#endif /* _HUDHealthBar_H__ */
Note: See TracBrowser for help on using the repository browser.