Changeset 1614 for code/branches/hud/src/orxonox/overlays/hud/HUDRadar.h
- Timestamp:
- Jun 21, 2008, 2:35:24 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud/src/orxonox/overlays/hud/HUDRadar.h
r1613 r1614 22 22 * Author: 23 23 * Yuning Chai 24 * Felix Schulthess 24 25 * Co-authors: 25 * Felix Schulthess26 * Reto Grieder 26 27 * 27 28 */ … … 32 33 #include "OrxonoxPrereqs.h" 33 34 35 #include <vector> 36 #include <map> 34 37 #include <OgrePrerequisites.h> 35 #include <OgrePanelOverlayElement.h>36 38 #include "overlays/OrxonoxOverlay.h" 37 #include "objects/Tickable.h" 38 #include "core/BaseObject.h" 39 #include "util/Math.h" 40 #include "core/Debug.h" 41 #include "Radar.h" 39 #include "RadarListener.h" 40 #include "RadarViewable.h" 42 41 43 42 namespace orxonox 44 43 { 45 template <class T, int Dummy> 46 class _OrxonoxExport RadarAttribute : public BaseObject 47 { 48 public: 49 RadarAttribute(); 50 ~RadarAttribute() { } 51 52 void XMLPort(Element& xmlElement, XMLPort::Mode mode); 53 void loadAttribute(Element& xmlElement, XMLPort::Mode mode); 54 55 void setAttribute(const T& attribute) { this->attribute_ = attribute; } 56 const T& getAttribute() const { return this->attribute_; } 57 58 void setIndex(unsigned int index); 59 unsigned int getIndex() { return this->index_; } 60 61 private: 62 unsigned int index_; 63 T attribute_; 64 }; 65 66 template <class T, int Dummy> 67 void RadarAttribute<T, Dummy>::setIndex(unsigned int index) 68 { 69 if (index > 0xFF) 70 { 71 COUT(1) << "Shape index was larger than 255 while parsing a RadarAttribute. " 72 << "Using random number!!!" << std::endl; 73 this->index_ = rand() & 0xFF; 74 } 75 else 76 this->index_ = index; 77 } 78 79 typedef RadarAttribute<std::string, 1> RadarShape; 80 81 template <> 82 RadarShape::RadarAttribute() : index_(0) 83 { RegisterObject(RadarShape); } 84 85 template <> 86 void RadarShape::XMLPort(Element& xmlElement, XMLPort::Mode mode) 87 { 88 BaseObject::XMLPort(xmlElement, mode); 89 XMLPortParam(RadarShape, "shape", setAttribute, getAttribute, xmlElement, mode); 90 XMLPortParam(RadarShape, "index", setIndex, getIndex, xmlElement, mode); 91 } 92 93 94 class _OrxonoxExport HUDRadar : public OrxonoxOverlay, public RadarListener//, public Tickable 44 class _OrxonoxExport HUDRadar : public OrxonoxOverlay, public RadarListener 95 45 { 96 46 public: … … 99 49 100 50 void XMLPort(Element& xmlElement, XMLPort::Mode mode); 101 102 /*void addShape(RadarShape* shape);103 RadarShape* getShape(unsigned int index) const;*/104 51 105 52 float getRadarSensitivity() const { return this->sensitivity_; } … … 112 59 void setMaximumDotSize(float size) { this->maximumDotSize_ = size; } 113 60 114 //void tick(float dt);115 116 //void listObjects();117 118 61 private: 119 62 void displayObject(RadarViewable* viewable, bool bIsMarked); 120 void hideMarker() { this->marker_->hide(); }121 63 float getRadarSensitivity() { return 1.0f; } 122 64 void radarTick(float dt); … … 124 66 std::map<RadarViewable::Shape, std::string> shapeMaterials_; 125 67 126 Ogre::PanelOverlayElement* background_;127 std:: map<RadarViewable*, Ogre::PanelOverlayElement*> radarDots_;68 std::vector<Ogre::PanelOverlayElement*> radarDots_; 69 std::vector<Ogre::PanelOverlayElement*>::iterator itRadarDots_; 128 70 Ogre::PanelOverlayElement* marker_; 129 71
Note: See TracChangeset
for help on using the changeset viewer.