[1505] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
[1454] | 4 | * |
---|
[1505] | 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 | * |
---|
[1454] | 22 | * Author: |
---|
| 23 | * Felix Schulthess |
---|
| 24 | * Co-authors: |
---|
[1590] | 25 | * Reto Grieder |
---|
[9016] | 26 | * Matthias Spalinger |
---|
[1454] | 27 | * |
---|
| 28 | */ |
---|
[1393] | 29 | |
---|
[1601] | 30 | #ifndef _HUDNavigation_H__ |
---|
| 31 | #define _HUDNavigation_H__ |
---|
[1393] | 32 | |
---|
[5693] | 33 | #include "overlays/OverlaysPrereqs.h" |
---|
[1410] | 34 | |
---|
[7163] | 35 | #include <map> |
---|
| 36 | #include <string> |
---|
| 37 | |
---|
[3196] | 38 | #include "util/OgreForwardRefs.h" |
---|
[5693] | 39 | #include "tools/interfaces/Tickable.h" |
---|
[7163] | 40 | #include "interfaces/RadarListener.h" |
---|
[1601] | 41 | #include "overlays/OrxonoxOverlay.h" |
---|
[1393] | 42 | |
---|
| 43 | namespace orxonox |
---|
| 44 | { |
---|
[9348] | 45 | class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable, public RadarListener |
---|
| 46 | { |
---|
| 47 | public: |
---|
[9667] | 48 | HUDNavigation(Context* context); |
---|
[9348] | 49 | virtual ~HUDNavigation(); |
---|
[7163] | 50 | |
---|
[9348] | 51 | void setConfigValues(); |
---|
[7163] | 52 | |
---|
[9348] | 53 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
| 54 | virtual void tick(float dt); |
---|
[7163] | 55 | |
---|
[9348] | 56 | // RadarListener interface |
---|
| 57 | virtual void addObject(RadarViewable* object); |
---|
| 58 | virtual void removeObject(RadarViewable* viewable); |
---|
| 59 | virtual void objectChanged(RadarViewable* viewable); |
---|
[7163] | 60 | |
---|
[9348] | 61 | virtual void changedOwner(); |
---|
| 62 | virtual void sizeChanged(); |
---|
| 63 | virtual void angleChanged() { } |
---|
| 64 | virtual void positionChanged() { } |
---|
| 65 | virtual void radarTick(float dt) {} |
---|
[7163] | 66 | |
---|
[9348] | 67 | inline float getRadarSensitivity() const |
---|
| 68 | { return 1.0f; } |
---|
[7163] | 69 | |
---|
[9348] | 70 | inline unsigned int getMarkerLimit() const |
---|
| 71 | { return this->markerLimit_; } |
---|
[9016] | 72 | |
---|
[9526] | 73 | static void selectClosestTarget(); |
---|
| 74 | static void selectNextTarget(); |
---|
| 75 | |
---|
[9348] | 76 | private: |
---|
| 77 | struct ObjectInfo |
---|
| 78 | { |
---|
[10242] | 79 | |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | Ogre::PanelOverlayElement* health_; |
---|
| 83 | Ogre::PanelOverlayElement* healthLevel_; |
---|
[9348] | 84 | Ogre::PanelOverlayElement* panel_; |
---|
[9526] | 85 | Ogre::PanelOverlayElement* target_; |
---|
[9348] | 86 | Ogre::TextAreaOverlayElement* text_; |
---|
| 87 | bool outOfView_; |
---|
| 88 | bool wasOutOfView_; |
---|
[9526] | 89 | bool selected_; |
---|
[9348] | 90 | }; |
---|
[1393] | 91 | |
---|
[9348] | 92 | bool showObject(RadarViewable* rv); |
---|
[1590] | 93 | |
---|
[9348] | 94 | // XMLPort accessors |
---|
[10242] | 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 | |
---|
[9348] | 111 | inline void setNavMarkerSize(float size) |
---|
| 112 | { |
---|
[9526] | 113 | this->navMarkerSize_ = size; |
---|
[9348] | 114 | this->sizeChanged(); |
---|
| 115 | } |
---|
| 116 | inline float getNavMarkerSize() const |
---|
| 117 | { return navMarkerSize_; } |
---|
[9526] | 118 | inline void setAimMarkerSize(float size) |
---|
| 119 | { |
---|
| 120 | this->aimMarkerSize_ = size; |
---|
| 121 | this->sizeChanged(); |
---|
| 122 | } |
---|
[10242] | 123 | |
---|
[9526] | 124 | inline float getAimMarkerSize() const |
---|
| 125 | { return aimMarkerSize_; } |
---|
[9348] | 126 | inline void setDetectionLimit(float limit) |
---|
| 127 | { this->detectionLimit_ = limit; } |
---|
| 128 | inline float getDetectionLimit() const |
---|
| 129 | { return this->detectionLimit_; } |
---|
[1604] | 130 | |
---|
[9348] | 131 | void setTextSize(float size); |
---|
| 132 | float getTextSize() const; |
---|
[1615] | 133 | |
---|
[9348] | 134 | void setFont(const std::string& font); |
---|
| 135 | const std::string& getFont() const; |
---|
[1615] | 136 | |
---|
[9348] | 137 | float getArrowSizeX(int dist) const; |
---|
| 138 | float getArrowSizeY(int dist) const; |
---|
[1615] | 139 | |
---|
[9526] | 140 | Vector3* toAimPosition(RadarViewable* target) const; |
---|
| 141 | |
---|
[9348] | 142 | std::map<RadarViewable*, ObjectInfo> activeObjectList_; |
---|
| 143 | std::list<std::pair<RadarViewable*, unsigned int> > sortedObjectList_; |
---|
[1590] | 144 | |
---|
[10242] | 145 | float healthMarkerSize_; |
---|
| 146 | float healthLevelMarkerSize_; |
---|
[9348] | 147 | float navMarkerSize_; |
---|
[9526] | 148 | float aimMarkerSize_; |
---|
[9348] | 149 | std::string fontName_; |
---|
| 150 | float textSize_; |
---|
| 151 | bool showDistance_; |
---|
[1615] | 152 | |
---|
[9526] | 153 | RadarViewable* selectedTarget_; |
---|
| 154 | |
---|
| 155 | bool closestTarget_; |
---|
| 156 | bool nextTarget_; |
---|
| 157 | |
---|
| 158 | static HUDNavigation* localHUD_s; //!< This is used as a filter. Only the local HUD should be influenced by the static Console Command functions. |
---|
| 159 | |
---|
| 160 | |
---|
| 161 | float currentMunitionSpeed_; |
---|
| 162 | |
---|
[9348] | 163 | unsigned int markerLimit_; |
---|
| 164 | float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value. |
---|
| 165 | }; |
---|
[1393] | 166 | } |
---|
| 167 | |
---|
[1601] | 168 | #endif /* _HUDNavigation_H__ */ |
---|