[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 | |
---|
| 38 | |
---|
[3196] | 39 | #include "util/OgreForwardRefs.h" |
---|
[5693] | 40 | #include "tools/interfaces/Tickable.h" |
---|
[7163] | 41 | #include "interfaces/RadarListener.h" |
---|
[1601] | 42 | #include "overlays/OrxonoxOverlay.h" |
---|
[1393] | 43 | |
---|
[9177] | 44 | |
---|
[1393] | 45 | namespace orxonox |
---|
| 46 | { |
---|
[7163] | 47 | class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable, public RadarListener |
---|
| 48 | { |
---|
| 49 | public: |
---|
| 50 | HUDNavigation ( BaseObject* creator ); |
---|
| 51 | virtual ~HUDNavigation(); |
---|
| 52 | |
---|
| 53 | void setConfigValues(); |
---|
| 54 | |
---|
[9177] | 55 | |
---|
| 56 | |
---|
[7401] | 57 | virtual void XMLPort ( Element& xmlelement, XMLPort::Mode mode ); |
---|
[7163] | 58 | virtual void tick ( float dt ); |
---|
| 59 | |
---|
[9016] | 60 | // RadarListener interface |
---|
[7163] | 61 | virtual void addObject ( RadarViewable* object ); |
---|
| 62 | virtual void removeObject ( RadarViewable* viewable ); |
---|
| 63 | virtual void objectChanged ( RadarViewable* viewable ); |
---|
| 64 | |
---|
| 65 | virtual void changedOwner(); |
---|
| 66 | virtual void sizeChanged(); |
---|
| 67 | virtual void angleChanged() { } |
---|
| 68 | virtual void positionChanged() { } |
---|
| 69 | virtual void radarTick ( float dt ) {} |
---|
| 70 | |
---|
| 71 | inline float getRadarSensitivity() const |
---|
| 72 | { return 1.0f; } |
---|
| 73 | |
---|
[9016] | 74 | unsigned int getMarkerLimit() { return this->markerLimit_; } |
---|
| 75 | |
---|
[7163] | 76 | private: |
---|
| 77 | struct ObjectInfo |
---|
[1393] | 78 | { |
---|
[7163] | 79 | Ogre::PanelOverlayElement* panel_; |
---|
| 80 | Ogre::TextAreaOverlayElement* text_; |
---|
| 81 | bool outOfView_; |
---|
| 82 | bool wasOutOfView_; |
---|
[1393] | 83 | |
---|
[7163] | 84 | }; |
---|
[1590] | 85 | |
---|
[9177] | 86 | void showArrow3D(); |
---|
| 87 | void hideArrow3D(); |
---|
| 88 | |
---|
[7163] | 89 | bool showObject( RadarViewable* rv ); |
---|
[1604] | 90 | |
---|
[7163] | 91 | // XMLPort accessors |
---|
| 92 | void setNavMarkerSize ( float size ) |
---|
[9016] | 93 | { navMarkerSize_ = size; this->sizeChanged(); } |
---|
[7163] | 94 | float getNavMarkerSize() const |
---|
[9016] | 95 | { return navMarkerSize_; } |
---|
| 96 | void setDetectionLimit( float limit ) |
---|
| 97 | { this->detectionLimit_ = limit; } |
---|
| 98 | float getDetectionLimit() const |
---|
| 99 | { return this->detectionLimit_; } |
---|
[1615] | 100 | |
---|
[7163] | 101 | void setTextSize ( float size ); |
---|
| 102 | float getTextSize() const; |
---|
[1615] | 103 | |
---|
[7163] | 104 | void setFont ( const std::string& font ); |
---|
| 105 | const std::string& getFont() const; |
---|
[1615] | 106 | |
---|
[7163] | 107 | typedef std::map<RadarViewable*, ObjectInfo > ObjectMap; |
---|
| 108 | ObjectMap activeObjectList_; |
---|
[1590] | 109 | |
---|
[7163] | 110 | typedef std::list < std::pair<RadarViewable*, unsigned int > > sortedList; |
---|
| 111 | sortedList sortedObjectList_; |
---|
[1615] | 112 | |
---|
[9016] | 113 | float getArrowSizeX(int dist); |
---|
| 114 | float getArrowSizeY(int dist); |
---|
[7163] | 115 | |
---|
| 116 | float navMarkerSize_; |
---|
| 117 | std::string fontName_; |
---|
| 118 | float textSize_; |
---|
[9016] | 119 | bool showDistance; |
---|
[7163] | 120 | |
---|
[9016] | 121 | unsigned int markerLimit_; |
---|
| 122 | float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value. |
---|
| 123 | |
---|
[7163] | 124 | }; |
---|
[1393] | 125 | } |
---|
| 126 | |
---|
[1601] | 127 | #endif /* _HUDNavigation_H__ */ |
---|