[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 |
---|
[1454] | 26 | * |
---|
| 27 | */ |
---|
[1393] | 28 | |
---|
[1601] | 29 | #ifndef _HUDNavigation_H__ |
---|
| 30 | #define _HUDNavigation_H__ |
---|
[1393] | 31 | |
---|
[5693] | 32 | #include "overlays/OverlaysPrereqs.h" |
---|
[1410] | 33 | |
---|
[7163] | 34 | #include <map> |
---|
| 35 | #include <string> |
---|
| 36 | |
---|
| 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 | { |
---|
[7163] | 45 | class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable, public RadarListener |
---|
| 46 | { |
---|
| 47 | public: |
---|
| 48 | HUDNavigation ( BaseObject* creator ); |
---|
| 49 | virtual ~HUDNavigation(); |
---|
| 50 | |
---|
| 51 | void setConfigValues(); |
---|
| 52 | |
---|
[7401] | 53 | virtual void XMLPort ( Element& xmlelement, XMLPort::Mode mode ); |
---|
[7163] | 54 | virtual void tick ( float dt ); |
---|
| 55 | |
---|
| 56 | virtual void addObject ( RadarViewable* object ); |
---|
| 57 | virtual void removeObject ( RadarViewable* viewable ); |
---|
| 58 | virtual void objectChanged ( RadarViewable* viewable ); |
---|
| 59 | |
---|
| 60 | virtual void changedOwner(); |
---|
| 61 | virtual void sizeChanged(); |
---|
| 62 | virtual void angleChanged() { } |
---|
| 63 | virtual void positionChanged() { } |
---|
| 64 | virtual void radarTick ( float dt ) {} |
---|
| 65 | |
---|
| 66 | inline float getRadarSensitivity() const |
---|
| 67 | { return 1.0f; } |
---|
| 68 | |
---|
| 69 | private: |
---|
| 70 | struct ObjectInfo |
---|
[1393] | 71 | { |
---|
[7163] | 72 | Ogre::PanelOverlayElement* panel_; |
---|
| 73 | Ogre::TextAreaOverlayElement* text_; |
---|
| 74 | bool outOfView_; |
---|
| 75 | bool wasOutOfView_; |
---|
[1393] | 76 | |
---|
[7163] | 77 | }; |
---|
[1590] | 78 | |
---|
[7163] | 79 | bool showObject( RadarViewable* rv ); |
---|
[1604] | 80 | |
---|
[7163] | 81 | // XMLPort accessors |
---|
| 82 | void setNavMarkerSize ( float size ) |
---|
| 83 | { navMarkerSize_ = size; this->sizeChanged(); } |
---|
| 84 | float getNavMarkerSize() const |
---|
| 85 | { return navMarkerSize_; } |
---|
[1615] | 86 | |
---|
[8891] | 87 | void setDetectionLimit( float limit ) |
---|
| 88 | { this->detectionLimit_ = limit; } |
---|
| 89 | float getDetectionLimit() const |
---|
| 90 | { return this->detectionLimit_; } |
---|
| 91 | |
---|
[7163] | 92 | void setTextSize ( float size ); |
---|
| 93 | float getTextSize() const; |
---|
[1615] | 94 | |
---|
[7163] | 95 | void setFont ( const std::string& font ); |
---|
| 96 | const std::string& getFont() const; |
---|
[1615] | 97 | |
---|
[7163] | 98 | typedef std::map<RadarViewable*, ObjectInfo > ObjectMap; |
---|
| 99 | ObjectMap activeObjectList_; |
---|
[1590] | 100 | |
---|
[7163] | 101 | typedef std::list < std::pair<RadarViewable*, unsigned int > > sortedList; |
---|
| 102 | sortedList sortedObjectList_; |
---|
[1615] | 103 | |
---|
[7163] | 104 | |
---|
| 105 | float navMarkerSize_; |
---|
| 106 | std::string fontName_; |
---|
| 107 | float textSize_; |
---|
| 108 | |
---|
[8891] | 109 | unsigned int markerLimit_; //TODO: is it possible to set this over the console and/or the IG-Setting |
---|
| 110 | float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value. |
---|
| 111 | //!< In order to bypass this behaviour, set a negative detectionLimit_. Then the detection range is "infinite". |
---|
[7163] | 112 | }; |
---|
[1393] | 113 | } |
---|
| 114 | |
---|
[1601] | 115 | #endif /* _HUDNavigation_H__ */ |
---|