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