[1505] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
[1502] | 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 | * |
---|
[1502] | 22 | * Author: |
---|
| 23 | * Yuning Chai |
---|
[1614] | 24 | * Felix Schulthess |
---|
[1502] | 25 | * Co-authors: |
---|
[1614] | 26 | * Reto Grieder |
---|
[1502] | 27 | * |
---|
| 28 | */ |
---|
[1283] | 29 | |
---|
[1604] | 30 | #ifndef _HUDRadar_H__ |
---|
| 31 | #define _HUDRadar_H__ |
---|
[1283] | 32 | |
---|
[5693] | 33 | #include "overlays/OverlaysPrereqs.h" |
---|
[1502] | 34 | |
---|
[3196] | 35 | #include <map> |
---|
[1614] | 36 | #include <vector> |
---|
[3196] | 37 | |
---|
| 38 | #include "util/OgreForwardRefs.h" |
---|
| 39 | #include "interfaces/RadarListener.h" |
---|
| 40 | #include "interfaces/RadarViewable.h" |
---|
[1604] | 41 | #include "overlays/OrxonoxOverlay.h" |
---|
[1407] | 42 | |
---|
[1283] | 43 | namespace orxonox |
---|
| 44 | { |
---|
[5693] | 45 | class _OverlaysExport HUDRadar : public OrxonoxOverlay, public RadarListener |
---|
[1329] | 46 | { |
---|
[1615] | 47 | public: |
---|
[2087] | 48 | HUDRadar(BaseObject* creator); |
---|
[3196] | 49 | virtual ~HUDRadar(); |
---|
[1400] | 50 | |
---|
[7401] | 51 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
[2662] | 52 | virtual void changedOwner(); |
---|
[1604] | 53 | |
---|
[1615] | 54 | private: |
---|
| 55 | // XML accessors |
---|
[1613] | 56 | float getHalfDotSizeDistance() const { return this->halfDotSizeDistance_; } |
---|
| 57 | void setHalfDotSizeDistance(float distance) { this->halfDotSizeDistance_ = distance; } |
---|
[1604] | 58 | |
---|
[8891] | 59 | void setDetectionLimit( float limit ) |
---|
| 60 | { this->detectionLimit_ = limit; } |
---|
| 61 | float getDetectionLimit() const |
---|
| 62 | { return this->detectionLimit_; } |
---|
| 63 | |
---|
[1613] | 64 | float getMaximumDotSize() const { return this->maximumDotSize_; } |
---|
| 65 | void setMaximumDotSize(float size) { this->maximumDotSize_ = size; } |
---|
| 66 | |
---|
[1615] | 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 |
---|
[7163] | 72 | virtual void addObject(RadarViewable* viewable); |
---|
| 73 | virtual void removeObject(RadarViewable* viewable); |
---|
| 74 | virtual void objectChanged( RadarViewable* rv ); |
---|
[1613] | 75 | void radarTick(float dt); |
---|
[8891] | 76 | bool showObject( RadarViewable* rv ); //!< Do not display an object on radar, if showObject(.) is false. |
---|
[1604] | 77 | |
---|
[7163] | 78 | void gatherObjects(); |
---|
| 79 | |
---|
[1613] | 80 | std::map<RadarViewable::Shape, std::string> shapeMaterials_; |
---|
[1604] | 81 | |
---|
[7163] | 82 | // std::vector<Ogre::PanelOverlayElement*> radarDots_; |
---|
| 83 | // std::vector<Ogre::PanelOverlayElement*>::iterator itRadarDots_; |
---|
| 84 | std::map<RadarViewable*, Ogre::PanelOverlayElement*> radarObjects_; |
---|
[1613] | 85 | Ogre::PanelOverlayElement* marker_; |
---|
| 86 | |
---|
| 87 | float halfDotSizeDistance_; |
---|
| 88 | float maximumDotSize_; |
---|
| 89 | |
---|
| 90 | float sensitivity_; |
---|
[8891] | 91 | float detectionLimit_; |
---|
[7880] | 92 | ControllableEntity* owner_; |
---|
[1604] | 93 | }; |
---|
[1302] | 94 | } |
---|
[1283] | 95 | |
---|
[1604] | 96 | #endif /* _HUDRadar_H__ */ |
---|