| [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 | |
|---|
| [6849] | 32 | #include <utility> |
|---|
| 33 | #include <map> |
|---|
| [5693] | 34 | #include "overlays/OverlaysPrereqs.h" |
|---|
| [6897] | 35 | #include "interfaces/RadarViewable.h" |
|---|
| [1410] | 36 | |
|---|
| [6849] | 37 | #include "interfaces/RadarListener.h" |
|---|
| [3196] | 38 | #include "util/OgreForwardRefs.h" |
|---|
| [5693] | 39 | #include "tools/interfaces/Tickable.h" |
|---|
| [1601] | 40 | #include "overlays/OrxonoxOverlay.h" |
|---|
| [1393] | 41 | |
|---|
| [6796] | 42 | #include <vector> |
|---|
| 43 | |
|---|
| [1393] | 44 | namespace orxonox |
|---|
| 45 | { |
|---|
| [6874] | 46 | class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable, public RadarListener |
|---|
| 47 | { |
|---|
| 48 | public: |
|---|
| 49 | HUDNavigation(BaseObject* creator); |
|---|
| 50 | virtual ~HUDNavigation(); |
|---|
| [1393] | 51 | |
|---|
| [6874] | 52 | virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode); |
|---|
| 53 | virtual void tick(float dt); |
|---|
| 54 | virtual void addObject(RadarViewable* object); |
|---|
| [1590] | 55 | |
|---|
| [6874] | 56 | virtual void removeObject(RadarViewable* viewable); |
|---|
| 57 | virtual void objectChanged(RadarViewable* viewable) {} |
|---|
| 58 | inline float getRadarSensitivity() const {return 1.0f;} |
|---|
| 59 | inline void radarTick(float dt) {} |
|---|
| [6898] | 60 | virtual void changedOwner(); |
|---|
| [6796] | 61 | |
|---|
| [6874] | 62 | |
|---|
| 63 | private: |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | void sizeChanged(); |
|---|
| 68 | void angleChanged() { } |
|---|
| 69 | void positionChanged() { } |
|---|
| 70 | |
|---|
| [6865] | 71 | // void updateActiveObjectList(map activeObjectList_); |
|---|
| [1604] | 72 | |
|---|
| [1615] | 73 | |
|---|
| 74 | |
|---|
| [6874] | 75 | // XMLPort accessors |
|---|
| 76 | void setNavMarkerSize(float size) { |
|---|
| 77 | navMarkerSize_ = size; |
|---|
| 78 | this->sizeChanged(); |
|---|
| 79 | } |
|---|
| 80 | float getNavMarkerSize() const { |
|---|
| 81 | return navMarkerSize_; |
|---|
| 82 | } |
|---|
| [1615] | 83 | |
|---|
| [6874] | 84 | /* |
|---|
| 85 | void setAimMarkerSize(float size) { this->aimMarkerSize_ = size; this->sizeChanged(); } |
|---|
| 86 | float getAimMarkerSize() const { return this->aimMarkerSize_; } |
|---|
| 87 | */ |
|---|
| [1590] | 88 | |
|---|
| [6874] | 89 | void setTextSize(float size); |
|---|
| 90 | float getTextSize() const; |
|---|
| [6865] | 91 | |
|---|
| [6874] | 92 | void setFont(const std::string& font); |
|---|
| 93 | const std::string& getFont() const; |
|---|
| [6873] | 94 | |
|---|
| [6874] | 95 | void updateMarker(); |
|---|
| 96 | void updateFocus(); |
|---|
| [6898] | 97 | // float getDist2Focus() const; |
|---|
| [6874] | 98 | void getSingleton(); |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | void updateActiveObjectMap(); |
|---|
| 102 | |
|---|
| 103 | Ogre::PanelOverlayElement* navMarker_; //!< the panel used to show the arrow and the target marker |
|---|
| 104 | float navMarkerSize_; //!< One paramter size of the navigation marker |
|---|
| 105 | /* |
|---|
| 106 | Ogre::PanelOverlayElement* aimMarker_; //!< Panel used to show the aim Marker |
|---|
| 107 | float aimMarkerSize_; //!< One paramter size of the aim marker |
|---|
| 108 | */ |
|---|
| 109 | Ogre::TextAreaOverlayElement* navText_; //!< Text overlay to display the target distance |
|---|
| 110 | bool wasOutOfView_; //!< Performance booster variable: setMaterial is not cheap |
|---|
| 111 | |
|---|
| 112 | typedef std::map<RadarViewable*, std::pair<Ogre::PanelOverlayElement*, Ogre::TextAreaOverlayElement*> > activeObjectListType; |
|---|
| 113 | activeObjectListType activeObjectList_; |
|---|
| 114 | activeObjectListType::iterator tempRadarViewable; |
|---|
| [6898] | 115 | |
|---|
| [6897] | 116 | typedef std::set<RadarViewable*> respawnObjectSetType; |
|---|
| [6898] | 117 | |
|---|
| [6874] | 118 | |
|---|
| [6898] | 119 | |
|---|
| [6874] | 120 | std::string fontName_; |
|---|
| 121 | float textSize_; |
|---|
| 122 | |
|---|
| 123 | }; |
|---|
| 124 | |
|---|
| [1393] | 125 | } |
|---|
| 126 | |
|---|
| [1601] | 127 | #endif /* _HUDNavigation_H__ */ |
|---|