Orxonox  0.0.5 Codename: Arcturus
WagnisHUD.h
Go to the documentation of this file.
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  * Roman Kunz
24 
25  *
26  */
27 
28 #ifndef _WagnisHUD_H__
29 #define _WagnisHUD_H__
30 
32 
33 #include <map>
34 #include <string>
35 
36 #include "util/OgreForwardRefs.h"
40 
41 namespace orxonox
42 {
44  {
45  public:
46  WagnisHUD(Context* context);
47  virtual ~WagnisHUD();
48 
49  void setConfigValues();
50 
51  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
52  virtual void tick(float dt) override;
53 
54  // RadarListener interface
55  virtual void addObject(RadarViewable* object) override;
56  virtual void removeObject(RadarViewable* viewable) override;
57  virtual void objectChanged(RadarViewable* viewable) override;
58 
59  virtual void changedOwner() override;
60  virtual void sizeChanged() override;
61  virtual void angleChanged() override { }
62  virtual void positionChanged() override { }
63  virtual void radarTick(float dt) override {}
64 
65  virtual inline float getRadarSensitivity() const override
66  { return 1.0f; }
67 
68  inline unsigned int getMarkerLimit() const
69  { return this->markerLimit_; }
70 
71  static void selectClosestTarget();
72  static void selectNextTarget();
73 
74  private:
75  struct ObjectInfo
76  {
77 
78 
79 
80  Ogre::PanelOverlayElement* health_;
81  Ogre::PanelOverlayElement* healthLevel_;
82  Ogre::PanelOverlayElement* panel_;
83  Ogre::PanelOverlayElement* target_;
84  Ogre::TextAreaOverlayElement* text_;
85  bool outOfView_;
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 setHealthLevelMarkerSize(float size)
102  {
103  this->healthLevelMarkerSize_ = size;
104  this->sizeChanged();
105  }
106  inline float getHealthLevelMarkerSize() const
107  { return healthLevelMarkerSize_; }
108 
109  inline void setNavMarkerSize(float size)
110  {
111  this->navMarkerSize_ = size;
112  this->sizeChanged();
113  }
114  inline float getNavMarkerSize() const
115  { return navMarkerSize_; }
116  inline void setAimMarkerSize(float size)
117  {
118  this->aimMarkerSize_ = size;
119  this->sizeChanged();
120  }
121 
122  inline float getAimMarkerSize() const
123  { return aimMarkerSize_; }
124  inline void setDetectionLimit(float limit)
125  { this->detectionLimit_ = limit; }
126  inline float getDetectionLimit() const
127  { return this->detectionLimit_; }
128 
129  void setTextSize(float size);
130  float getTextSize() const;
131 
132  void setFont(const std::string& font);
133  const std::string& getFont() const;
134 
135  float getArrowSizeX(int dist) const;
136  float getArrowSizeY(int dist) const;
137 
138  Vector3 toAimPosition(RadarViewable* target) const;
139 
140  std::map<RadarViewable*, ObjectInfo> activeObjectList_;
141  std::list<std::pair<RadarViewable*, unsigned int>> sortedObjectList_;
142 
148  float textSize_;
150 
152 
155 
157 
158 
160 
161  unsigned int markerLimit_;
163  };
164 }
165 
166 #endif /* _WagnisHUD_H__ */
virtual void positionChanged() override
Determines the position of the overlay.
Definition: WagnisHUD.h:62
float aimMarkerSize_
Definition: WagnisHUD.h:146
float getNavMarkerSize() const
Definition: WagnisHUD.h:114
Definition: WagnisHUD.h:43
Declaration of the Tickable interface.
void setDetectionLimit(float limit)
Definition: WagnisHUD.h:124
float detectionLimit_
Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000...
Definition: WagnisHUD.h:162
::std::string string
Definition: gtest-port.h:756
bool showDistance_
Definition: WagnisHUD.h:149
Ogre::PanelOverlayElement * healthLevel_
Definition: WagnisHUD.h:81
Definition: RadarListener.h:37
Interface for receiving window events.
Definition: RadarViewable.h:48
Ogre::PanelOverlayElement * target_
Definition: WagnisHUD.h:83
void setHealthMarkerSize(float size)
Definition: WagnisHUD.h:93
RadarViewable * selectedTarget_
Definition: WagnisHUD.h:151
virtual void angleChanged() override
Called whenever the rotation angle has changed.
Definition: WagnisHUD.h:61
bool wasOutOfView_
Definition: WagnisHUD.h:86
xmlelement
Definition: Super.h:519
virtual void radarTick(float dt) override
Definition: WagnisHUD.h:63
Definition: WagnisHUD.h:75
float textSize_
Definition: WagnisHUD.h:148
void setHealthLevelMarkerSize(float size)
Definition: WagnisHUD.h:101
#define _OverlaysExport
Definition: OverlaysPrereqs.h:60
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Shared library macros, enums, constants and forward declarations for the overlays module ...
Ogre::PanelOverlayElement * health_
Definition: WagnisHUD.h:80
bool outOfView_
Definition: WagnisHUD.h:85
Mode
Definition: CorePrereqs.h:102
unsigned int markerLimit_
Definition: WagnisHUD.h:161
float getAimMarkerSize() const
Definition: WagnisHUD.h:122
float healthLevelMarkerSize_
Definition: WagnisHUD.h:144
float getDetectionLimit() const
Definition: WagnisHUD.h:126
float getHealthLevelMarkerSize() const
Definition: WagnisHUD.h:106
Definition: Context.h:45
void setNavMarkerSize(float size)
Definition: WagnisHUD.h:109
Base class to display content directly onto the screen.
Definition: OrxonoxOverlay.h:72
Declaration of the OrxonoxOverlay class.
static WagnisHUD * localHUD_s
This is used as a filter. Only the local HUD should be influenced by the static Console Command funct...
Definition: WagnisHUD.h:156
float currentMunitionSpeed_
Definition: WagnisHUD.h:159
std::map< RadarViewable *, ObjectInfo > activeObjectList_
Definition: WagnisHUD.h:140
float healthMarkerSize_
Definition: WagnisHUD.h:143
void setAimMarkerSize(float size)
Definition: WagnisHUD.h:116
bool nextTarget_
Definition: WagnisHUD.h:154
bool closestTarget_
Definition: WagnisHUD.h:153
float navMarkerSize_
Definition: WagnisHUD.h:145
std::list< std::pair< RadarViewable *, unsigned int > > sortedObjectList_
Definition: WagnisHUD.h:141
float getHealthMarkerSize() const
Definition: WagnisHUD.h:98
virtual float getRadarSensitivity() const override
Definition: WagnisHUD.h:65
The Tickable interface provides a tick(dt) function, that gets called every frame.
Definition: Tickable.h:52
unsigned int getMarkerLimit() const
Definition: WagnisHUD.h:68
Ogre::PanelOverlayElement * panel_
Definition: WagnisHUD.h:82
bool selected_
Definition: WagnisHUD.h:87
Ogre::TextAreaOverlayElement * text_
Definition: WagnisHUD.h:84
std::string fontName_
Definition: WagnisHUD.h:147