| [12136] | 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: | 
|---|
| [12159] | 23 |  *      Roman Kunz | 
|---|
 | 24 |  | 
|---|
| [12136] | 25 |  * | 
|---|
 | 26 |  */ | 
|---|
 | 27 |  | 
|---|
 | 28 | #ifndef _WagnisHUD_H__ | 
|---|
 | 29 | #define _WagnisHUD_H__ | 
|---|
 | 30 |  | 
|---|
 | 31 | #include "overlays/OverlaysPrereqs.h" | 
|---|
 | 32 |  | 
|---|
 | 33 | #include <map> | 
|---|
 | 34 | #include <string> | 
|---|
 | 35 |  | 
|---|
 | 36 | #include "util/OgreForwardRefs.h" | 
|---|
 | 37 | #include "tools/interfaces/Tickable.h" | 
|---|
 | 38 | #include "interfaces/RadarListener.h" | 
|---|
 | 39 | #include "overlays/OrxonoxOverlay.h" | 
|---|
 | 40 |  | 
|---|
 | 41 | namespace orxonox | 
|---|
 | 42 | { | 
|---|
 | 43 |     class _OverlaysExport WagnisHUD : public OrxonoxOverlay, public Tickable, public RadarListener | 
|---|
 | 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_; | 
|---|
 | 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 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 |  | 
|---|
 | 143 |             float healthMarkerSize_; | 
|---|
 | 144 |             float healthLevelMarkerSize_; | 
|---|
 | 145 |             float navMarkerSize_; | 
|---|
 | 146 |             float aimMarkerSize_; | 
|---|
 | 147 |             std::string fontName_; | 
|---|
 | 148 |             float textSize_; | 
|---|
 | 149 |             bool showDistance_; | 
|---|
 | 150 |  | 
|---|
 | 151 |             RadarViewable* selectedTarget_; | 
|---|
 | 152 |  | 
|---|
 | 153 |             bool closestTarget_; | 
|---|
 | 154 |             bool nextTarget_; | 
|---|
 | 155 |  | 
|---|
 | 156 |             static WagnisHUD* localHUD_s; //!< This is used as a filter. Only the local HUD should be influenced by the static Console Command functions. | 
|---|
 | 157 |  | 
|---|
 | 158 |  | 
|---|
 | 159 |             float currentMunitionSpeed_; | 
|---|
 | 160 |  | 
|---|
 | 161 |             unsigned int markerLimit_; | 
|---|
 | 162 |             float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value. | 
|---|
 | 163 |     }; | 
|---|
 | 164 | } | 
|---|
 | 165 |  | 
|---|
 | 166 | #endif /* _WagnisHUD_H__ */ | 
|---|