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 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _HUDNavigation_H__ |
---|
30 | #define _HUDNavigation_H__ |
---|
31 | |
---|
32 | #include <utility> |
---|
33 | #include <map> |
---|
34 | #include "overlays/OverlaysPrereqs.h" |
---|
35 | |
---|
36 | #include "interfaces/RadarListener.h" |
---|
37 | #include "util/OgreForwardRefs.h" |
---|
38 | #include "tools/interfaces/Tickable.h" |
---|
39 | #include "overlays/OrxonoxOverlay.h" |
---|
40 | |
---|
41 | #include <pair> |
---|
42 | #include <vector> |
---|
43 | |
---|
44 | namespace orxonox |
---|
45 | { |
---|
46 | class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable, public RadarListener |
---|
47 | { |
---|
48 | public: |
---|
49 | HUDNavigation(BaseObject* creator); |
---|
50 | virtual ~HUDNavigation(); |
---|
51 | |
---|
52 | virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode); |
---|
53 | virtual void tick(float dt); |
---|
54 | virtual void addObject(RadarViewable* object); |
---|
55 | |
---|
56 | virtual void removeObject(RadarViewable* viewable); |
---|
57 | virtual void objectChanged(RadarViewable* viewable){} |
---|
58 | inline float getRadarSensitivity() const{} |
---|
59 | inline void radarTick(float dt) {} |
---|
60 | |
---|
61 | private: |
---|
62 | |
---|
63 | void sizeChanged(); |
---|
64 | void angleChanged() { } |
---|
65 | void positionChanged() { } |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | // XMLPort accessors |
---|
70 | void setNavMarkerSize(float size) { this->navMarkerSize_ = size; this->sizeChanged(); } |
---|
71 | float getNavMarkerSize() const { return this->navMarkerSize_; } |
---|
72 | |
---|
73 | /* |
---|
74 | void setAimMarkerSize(float size) { this->aimMarkerSize_ = size; this->sizeChanged(); } |
---|
75 | float getAimMarkerSize() const { return this->aimMarkerSize_; } |
---|
76 | */ |
---|
77 | |
---|
78 | void setTextSize(float size); |
---|
79 | float getTextSize() const; |
---|
80 | |
---|
81 | void setFont(const std::string& font); |
---|
82 | const std::string& getFont() const; |
---|
83 | |
---|
84 | void updateMarker(); |
---|
85 | void updateFocus(); |
---|
86 | float getDist2Focus() const; |
---|
87 | void getSingleton(); |
---|
88 | void getSingleton(); |
---|
89 | |
---|
90 | void updateActiveObjectMap(); |
---|
91 | |
---|
92 | Ogre::PanelOverlayElement* navMarker_; //!< the panel used to show the arrow and the target marker |
---|
93 | float navMarkerSize_; //!< One paramter size of the navigation marker |
---|
94 | /* |
---|
95 | Ogre::PanelOverlayElement* aimMarker_; //!< Panel used to show the aim Marker |
---|
96 | float aimMarkerSize_; //!< One paramter size of the aim marker |
---|
97 | */ |
---|
98 | Ogre::TextAreaOverlayElement* navText_; //!< Text overlay to display the target distance |
---|
99 | bool wasOutOfView_; //!< Performance booster variable: setMaterial is not cheap |
---|
100 | |
---|
101 | std::map<RadarViewable*, std::pair<Ogre::PanelOverlayElement*, Ogre::TextAreaOverlayElement*> > activeObjectList_; |
---|
102 | |
---|
103 | }; |
---|
104 | |
---|
105 | } |
---|
106 | |
---|
107 | #endif /* _HUDNavigation_H__ */ |
---|