Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/overlays/hud/HUDHealthBar.h @ 7287

Last change on this file since 7287 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
RevLine 
[2369]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
[5693]32#include "overlays/OverlaysPrereqs.h"
[2369]33
[3196]34#include "util/Math.h"
[5693]35#include "tools/interfaces/Tickable.h"
[3196]36#include "overlays/OverlayText.h"
[2369]37#include "HUDBar.h"
38
39namespace orxonox
40{
[5693]41    class _OverlaysExport HUDHealthBar : public HUDBar, public Tickable
[2369]42    {
43        public:
44            HUDHealthBar(BaseObject* creator);
[3196]45            virtual ~HUDHealthBar();
[2369]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)
[6417]55                { if (!font.empty()) { this->textoverlay_->setFont(font); } }
[2369]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
[3196]67            inline void setTextAlignment(OverlayText::Alignment alignment)
[2369]68                { this->textoverlay_->setAlignment(alignment); }
[3196]69            inline OverlayText::Alignment getTextAlignment() const
[2369]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:
[5929]113            WeakPtr<Pawn> owner_;
[6054]114            SmartPtr<OverlayText> textoverlay_;
[2369]115            bool bUseBarColour_;
116            ColourValue textColour_;
117    };
118}
119#endif /* _HUDHealthBar_H__ */
Note: See TracBrowser for help on using the repository browser.