Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.h @ 10122

Last change on this file since 10122 was 10122, checked in by aejonas, 10 years ago

health bar is now under the spaceship while moving

  • Property svn:eol-style set to native
File size: 5.1 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 *      Felix Schulthess
24 *   Co-authors:
25 *      Reto Grieder
26 *      Matthias Spalinger
27 *
28 */
29
30#ifndef _HUDNavigation_H__
31#define _HUDNavigation_H__
32
33#include "overlays/OverlaysPrereqs.h"
34
35#include <map>
36#include <string>
37
38#include "util/OgreForwardRefs.h"
39#include "tools/interfaces/Tickable.h"
40#include "interfaces/RadarListener.h"
41#include "overlays/OrxonoxOverlay.h"
42
43namespace orxonox
44{
45    class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable, public RadarListener
46    {
47        public:
48            HUDNavigation(Context* context);
49            virtual ~HUDNavigation();
50
51            void setConfigValues();
52
53            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
54            virtual void tick(float dt);
55
56            // RadarListener interface
57            virtual void addObject(RadarViewable* object);
58            virtual void removeObject(RadarViewable* viewable);
59            virtual void objectChanged(RadarViewable* viewable);
60
61            virtual void changedOwner();
62            virtual void sizeChanged();
63            virtual void angleChanged() { }
64            virtual void positionChanged() { }
65            virtual void radarTick(float dt) {}
66
67            inline float getRadarSensitivity() const
68                { return 1.0f; }
69
70            inline unsigned int getMarkerLimit() const
71                { return this->markerLimit_; }
72
73            static void selectClosestTarget();
74            static void selectNextTarget();
75
76        private:
77            struct ObjectInfo
78            {
79
80                //manipulation bzw versuch !!! health additional
81                Ogre::PanelOverlayElement* health_;
82                Ogre::PanelOverlayElement* panel_;
83                Ogre::PanelOverlayElement* target_;
84                Ogre::TextAreaOverlayElement* text_;
85                bool outOfView_;
86                bool wasOutOfView_;
87                bool selected_;
88            };
89
90            bool showObject(RadarViewable* rv);
91
92            // XMLPort accessors
93            inline void setHealthMarkerSize(float size)
94                        {
95                            this->healthMarkerSize_ = size;
96                            this->sizeChanged();
97                        }
98            inline float getHealthMarkerSize() const
99                                { return healthMarkerSize_; }
100
101            inline void setNavMarkerSize(float size)
102            {
103                this->navMarkerSize_ = size;
104                this->sizeChanged();
105            }
106            inline float getNavMarkerSize() const
107                { return navMarkerSize_; }
108            inline void setAimMarkerSize(float size)
109            {
110                this->aimMarkerSize_ = size;
111                this->sizeChanged();
112            }
113
114            inline float getAimMarkerSize() const
115                { return aimMarkerSize_; }
116            inline void setDetectionLimit(float limit)
117                { this->detectionLimit_ = limit; }
118            inline float getDetectionLimit() const
119                { return this->detectionLimit_; }
120
121            void setTextSize(float size);
122            float getTextSize() const;
123
124            void setFont(const std::string& font);
125            const std::string& getFont() const;
126
127            float getArrowSizeX(int dist) const;
128            float getArrowSizeY(int dist) const;
129
130            Vector3* toAimPosition(RadarViewable* target) const;
131
132            std::map<RadarViewable*, ObjectInfo> activeObjectList_;
133            std::list<std::pair<RadarViewable*, unsigned int> > sortedObjectList_;
134
135            float healthMarkerSize_;
136            float navMarkerSize_;
137            float aimMarkerSize_;
138            std::string fontName_;
139            float textSize_;
140            bool showDistance_;
141
142            RadarViewable* selectedTarget_;
143
144            bool closestTarget_;
145            bool nextTarget_;
146
147            static HUDNavigation* localHUD_s; //!< This is used as a filter. Only the local HUD should be influenced by the static Console Command functions.
148
149
150            float currentMunitionSpeed_;
151
152            unsigned int markerLimit_;
153            float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value.
154    };
155}
156
157#endif /* _HUDNavigation_H__ */
Note: See TracBrowser for help on using the repository browser.