Changeset 6849 for code/branches/hudelements
- Timestamp:
- May 3, 2010, 5:03:05 PM (15 years ago)
- Location:
- code/branches/hudelements/src/modules/overlays/hud
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hudelements/src/modules/overlays/hud/HUDNavigation.cc
r6796 r6849 30 30 31 31 #include <string> 32 #include <vector>33 #include <map>34 32 #include <OgreCamera.h> 35 33 #include <OgreOverlayManager.h> 36 34 #include <OgreTextAreaOverlayElement.h> 37 35 #include <OgrePanelOverlayElement.h> 38 39 36 #include "util/Math.h" 40 37 #include "util/Convert.h" … … 47 44 #include "controllers/HumanController.h" 48 45 #include "worldentities/pawns/Pawn.h" 46 #include "worldentities/WorldEntity.h" 49 47 50 48 namespace orxonox … … 139 137 void HUDNavigation::tick(float dt) 140 138 { 141 142 143 139 SUPER(HUDNavigation, tick, dt); 144 140 … … 291 287 } 292 288 293 // map <WorldEntity*, pair <Ogre::PanelOverlayElement*, Ogre::TextAreaOverlayElement*> > ActiveObjectList; 289 void HUDNavigation::addObject(RadarViewable* object) 290 { 291 if (object == dynamic_cast<RadarViewable*>(this->getOwner())) 292 return; 293 294 assert(object); 295 296 // Make sure the object hasn't been added yet 297 assert( this->activeObjectList_.find(object) == this->activeObjectList_.end() ); 298 299 // Create everything needed to display the object on the radar and add it to the map 300 301 // create nav marker 302 Ogre::PanelOverlayElement* panel = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 303 .createOverlayElement("Panel", "HUDNavigation_navMarker_" + getUniqueNumberString())); 304 305 panel->setMaterialName("Orxonox/NavArrows"); 306 307 Ogre::TextAreaOverlayElement* text = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton() 308 .createOverlayElement("TextArea", "HUDNavigation_navText_" + getUniqueNumberString())); 309 310 activeObjectList_[object] = std::make_pair (panel, text) ; 311 activeObjectList_[object].first->show(); 312 activeObjectList_[object].second->show(); 313 } 294 314 295 // void updateActiveObjectMap(){296 // --> iteration durch die betsehende map über alle keys (Worldentity*) 297 // --> check: 'existiert noch' 'sizeChanged' 'angleChanged' 'positionChanged' 298 // --> update des aktuellen Objects (Panel & Text) 299 // --> lücke schliessen in der map (aufrücken nach links)300 // --> neue objekte suchen301 // -- map.add neue objekte hinzufügen (pair <panel, text> einfügen.302 // }303 315 void HUDNavigation::removeObject(RadarViewable* viewable){ 316 assert(activeObjectList_.find(viewable)!=activeObjectList_.end()); 317 activeObjectList_.erase(viewable); 318 } 319 // 320 // void HUDNavigation::objectChanged(RadarViewable* viewable){} 321 // float HUDNavigation::getRadarSensitivity(){} 322 // void HUDNavigation::radarTick(float dt){} 323 // 304 324 305 325 -
code/branches/hudelements/src/modules/overlays/hud/HUDNavigation.h
r6796 r6849 30 30 #define _HUDNavigation_H__ 31 31 32 #include <utility> 33 #include <map> 32 34 #include "overlays/OverlaysPrereqs.h" 33 35 36 #include "interfaces/RadarListener.h" 34 37 #include "util/OgreForwardRefs.h" 35 38 #include "tools/interfaces/Tickable.h" … … 41 44 namespace orxonox 42 45 { 43 class WorldEntity; 44 class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable 46 class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable, public RadarListener 45 47 { 46 48 public: … … 50 52 virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode); 51 53 virtual void tick(float dt); 52 53 virtual map <WorldEntity*, pair <Ogre::PanelOverlayElement*, Ogre::TextAreaOverlayElement*> > ActiveObjectList; 54 54 virtual void addObject(RadarViewable* object); 55 56 virtual void removeObject(RadarViewable* viewable); 57 virtual void objectChanged(RadarViewable* viewable){} 58 inline float getRadarSensitivity() const{} 59 inline void radarTick(float dt) {} 55 60 56 61 private: … … 63 68 64 69 // XMLPort accessors 65 void setNavMarkerSize(float size) { this->navMarkerSize_ = size; this->sizeChanged(); } 70 void setNavMarkerSize(float size) { this->navMarkerSize_ = size; this->sizeChanged(); } 66 71 float getNavMarkerSize() const { return this->navMarkerSize_; } 67 72 … … 94 99 bool wasOutOfView_; //!< Performance booster variable: setMaterial is not cheap 95 100 101 std::map<RadarViewable*, std::pair<Ogre::PanelOverlayElement*, Ogre::TextAreaOverlayElement*> > activeObjectList_; 96 102 97 103 }; 104 98 105 } 99 106 -
code/branches/hudelements/src/modules/overlays/hud/HUDRadar.cc
r6727 r6849 45 45 namespace orxonox 46 46 { 47 CreateFactory(HUDRadar); 47 CreateFactory(HUDRadar); 48 48 49 49 HUDRadar::HUDRadar(BaseObject* creator)
Note: See TracChangeset
for help on using the changeset viewer.