| 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: |
|---|
| 23 | * Yuning Chai |
|---|
| 24 | * Felix Schulthess |
|---|
| 25 | * Co-authors: |
|---|
| 26 | * Reto Grieder |
|---|
| 27 | * |
|---|
| 28 | */ |
|---|
| 29 | |
|---|
| 30 | #ifndef _HUDRadar_H__ |
|---|
| 31 | #define _HUDRadar_H__ |
|---|
| 32 | |
|---|
| 33 | #include "overlays/OverlaysPrereqs.h" |
|---|
| 34 | |
|---|
| 35 | #include <map> |
|---|
| 36 | #include <vector> |
|---|
| 37 | |
|---|
| 38 | #include "util/OgreForwardRefs.h" |
|---|
| 39 | #include "interfaces/RadarListener.h" |
|---|
| 40 | #include "interfaces/RadarViewable.h" |
|---|
| 41 | #include "overlays/OrxonoxOverlay.h" |
|---|
| 42 | |
|---|
| 43 | namespace orxonox |
|---|
| 44 | { |
|---|
| 45 | class _OverlaysExport HUDRadar : public OrxonoxOverlay, public RadarListener |
|---|
| 46 | { |
|---|
| 47 | public: |
|---|
| 48 | HUDRadar(Context* context); |
|---|
| 49 | virtual ~HUDRadar(); |
|---|
| 50 | |
|---|
| 51 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
|---|
| 52 | virtual void changedOwner(); |
|---|
| 53 | |
|---|
| 54 | private: |
|---|
| 55 | // XML accessors |
|---|
| 56 | float getHalfDotSizeDistance() const { return this->halfDotSizeDistance_; } |
|---|
| 57 | void setHalfDotSizeDistance(float distance) { this->halfDotSizeDistance_ = distance; } |
|---|
| 58 | |
|---|
| 59 | void setDetectionLimit( float limit ) |
|---|
| 60 | { this->detectionLimit_ = limit; } |
|---|
| 61 | float getDetectionLimit() const |
|---|
| 62 | { return this->detectionLimit_; } |
|---|
| 63 | |
|---|
| 64 | float getMaximumDotSize() const { return this->maximumDotSize_; } |
|---|
| 65 | void setMaximumDotSize(float size) { this->maximumDotSize_ = size; } |
|---|
| 66 | |
|---|
| 67 | float getRadarSensitivity() const { return this->sensitivity_; } |
|---|
| 68 | // used also by RadarListener interface! |
|---|
| 69 | void setRadarSensitivity(float sensitivity) { this->sensitivity_ = sensitivity; } |
|---|
| 70 | |
|---|
| 71 | // RadarListener interface |
|---|
| 72 | virtual void addObject(RadarViewable* viewable); |
|---|
| 73 | virtual void removeObject(RadarViewable* viewable); |
|---|
| 74 | virtual void objectChanged( RadarViewable* rv ); |
|---|
| 75 | void radarTick(float dt); |
|---|
| 76 | bool showObject( RadarViewable* rv ); //!< Do not display an object on radar, if showObject(.) is false. |
|---|
| 77 | |
|---|
| 78 | void gatherObjects(); |
|---|
| 79 | |
|---|
| 80 | std::map<RadarViewable::Shape, std::string> shapeMaterials_; |
|---|
| 81 | |
|---|
| 82 | // std::vector<Ogre::PanelOverlayElement*> radarDots_; |
|---|
| 83 | // std::vector<Ogre::PanelOverlayElement*>::iterator itRadarDots_; |
|---|
| 84 | std::map<RadarViewable*, Ogre::PanelOverlayElement*> radarObjects_; |
|---|
| 85 | Ogre::PanelOverlayElement* marker_; |
|---|
| 86 | |
|---|
| 87 | float halfDotSizeDistance_; |
|---|
| 88 | float maximumDotSize_; |
|---|
| 89 | |
|---|
| 90 | float sensitivity_; |
|---|
| 91 | float detectionLimit_; |
|---|
| 92 | ControllableEntity* owner_; |
|---|
| 93 | }; |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | #endif /* _HUDRadar_H__ */ |
|---|