[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 | |
---|
[6942] | 34 | #include <map> |
---|
| 35 | #include <string> |
---|
| 36 | |
---|
[6971] | 37 | |
---|
[3196] | 38 | #include "util/OgreForwardRefs.h" |
---|
[5693] | 39 | #include "tools/interfaces/Tickable.h" |
---|
[6942] | 40 | #include "interfaces/RadarListener.h" |
---|
[1601] | 41 | #include "overlays/OrxonoxOverlay.h" |
---|
[1393] | 42 | |
---|
| 43 | namespace orxonox |
---|
| 44 | { |
---|
[6971] | 45 | class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable, public RadarListener |
---|
| 46 | { |
---|
| 47 | public: |
---|
| 48 | HUDNavigation ( BaseObject* creator ); |
---|
| 49 | virtual ~HUDNavigation(); |
---|
| 50 | |
---|
| 51 | virtual void XMLPort ( Element& xmlElement, XMLPort::Mode mode ); |
---|
| 52 | virtual void tick ( float dt ); |
---|
| 53 | |
---|
| 54 | virtual void addObject ( RadarViewable* object ); |
---|
| 55 | virtual void removeObject ( RadarViewable* viewable ); |
---|
| 56 | virtual void objectChanged ( RadarViewable* viewable ) {} |
---|
| 57 | |
---|
| 58 | virtual void changedOwner(); |
---|
| 59 | virtual void sizeChanged(); |
---|
| 60 | virtual void angleChanged() { } |
---|
| 61 | virtual void positionChanged() { } |
---|
| 62 | virtual void radarTick ( float dt ) {} |
---|
| 63 | |
---|
| 64 | inline float getRadarSensitivity() const |
---|
| 65 | { return 1.0f; } |
---|
| 66 | |
---|
| 67 | private: |
---|
| 68 | struct ObjectInfo |
---|
[1393] | 69 | { |
---|
[6971] | 70 | Ogre::PanelOverlayElement* panel_; |
---|
| 71 | Ogre::TextAreaOverlayElement* text_; |
---|
| 72 | bool outOfView_; |
---|
| 73 | bool wasOutOfView_; |
---|
[1393] | 74 | |
---|
[6971] | 75 | }; |
---|
[1590] | 76 | |
---|
[6971] | 77 | // XMLPort accessors |
---|
| 78 | void setNavMarkerSize ( float size ) |
---|
| 79 | { navMarkerSize_ = size; this->sizeChanged(); } |
---|
| 80 | float getNavMarkerSize() const |
---|
| 81 | { return navMarkerSize_; } |
---|
[6942] | 82 | |
---|
[6971] | 83 | void setTextSize ( float size ); |
---|
| 84 | float getTextSize() const; |
---|
[6942] | 85 | |
---|
[6971] | 86 | void setFont ( const std::string& font ); |
---|
| 87 | const std::string& getFont() const; |
---|
[6942] | 88 | |
---|
[6971] | 89 | typedef std::map<RadarViewable*, ObjectInfo > ObjectMap; |
---|
| 90 | ObjectMap activeObjectList_; |
---|
[1604] | 91 | |
---|
[6971] | 92 | typedef std::list < std::pair<RadarViewable*, unsigned int > > sortedList; |
---|
| 93 | sortedList sortedObjectList_; |
---|
[1615] | 94 | |
---|
| 95 | |
---|
[6971] | 96 | float navMarkerSize_; |
---|
| 97 | std::string fontName_; |
---|
| 98 | float textSize_; |
---|
[1590] | 99 | |
---|
[6971] | 100 | static const unsigned int markerLimit_ = 5; //TODO: is it possible to set this over the console and/or the IG-Setting |
---|
[1615] | 101 | |
---|
[6971] | 102 | |
---|
| 103 | }; |
---|
[1393] | 104 | } |
---|
| 105 | |
---|
[1601] | 106 | #endif /* _HUDNavigation_H__ */ |
---|