Changeset 11702 for code/trunk/src/modules/overlays/hud
- Timestamp:
- Jan 6, 2018, 2:01:20 AM (7 years ago)
- Location:
- code/trunk/src/modules/overlays/hud
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/overlays/hud/HUDPickupItem.cc
r11701 r11702 36 36 37 37 #include "core/CoreIncludes.h" 38 #include "core/XMLPort.h"39 #include "util/Convert.h"40 38 #include "core/class/Super.h" 39 #include "util/StringUtils.h" 41 40 #include "HUDPickupItem.h" 42 41 … … 68 67 } 69 68 70 void HUDPickupItem::hideMe( Pickupable* p, bool repaint)69 void HUDPickupItem::hideMe() 71 70 { 72 if(!repaint) return; //dont do anything, if we are not allowed to repaint because the level is terminating73 assert(overlayElement_);74 assert(this->background_);75 71 //overlayElement_->hide(); 76 72 this->background_->removeChild(overlayElement_->getName()); -
code/trunk/src/modules/overlays/hud/HUDPickupItem.h
r11353 r11702 5 5 #include "overlays/OverlaysPrereqs.h" 6 6 7 #include <map> 8 #include <vector> 9 #include <string> 10 11 #include <OgreOverlayManager.h> 12 #include <OgrePanelOverlayElement.h> 13 7 #include "util/OgreForwardRefs.h" 14 8 #include "overlays/OrxonoxOverlay.h" 15 #include "tools/interfaces/Tickable.h"16 #include "worldentities/pawns/Pawn.h"17 #include "overlays/OverlayGroup.h"18 #include "pickup/Pickup.h"19 9 20 10 namespace orxonox 21 11 { 22 class _OverlaysExport HUDPickupItem : public OrxonoxOverlay , public Tickable12 class _OverlaysExport HUDPickupItem : public OrxonoxOverlay 23 13 { 24 14 public: 25 15 HUDPickupItem(Context* context); 26 Ogre::PanelOverlayElement* overlayElement_;27 16 virtual ~HUDPickupItem(); 28 17 29 18 void initializeMaterial(const std::string& s, float x, float y); 30 void hideMe( Pickupable* p, bool repaint);19 void hideMe(); 31 20 32 private: 33 WeakPtr<Pawn> owner_; 34 WeakPtr<Pickup> pickup_; 35 21 private: 22 Ogre::PanelOverlayElement* overlayElement_; 36 23 }; 37 24 } -
code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc
r11701 r11702 30 30 #include <string> 31 31 32 #include <OgreOverlayManager.h> 33 #include <OgrePanelOverlayElement.h> 34 32 35 #include "core/CoreIncludes.h" 33 #include "core/XMLPort.h"34 #include "util/Convert.h"35 36 #include "core/class/Super.h" 37 #include "util/StringUtils.h" 36 38 #include "HUDPickupSystem.h" 39 #include "HUDPickupItem.h" 37 40 #include "pickup/Pickup.h" 38 #include "HUDPickupItem.h"39 41 #include "pickup/PickupManager.h" 40 42 … … 68 70 //hide all pickup symbols in HUD and delete from local map 69 71 70 for( const auto& sm_pair : picks)72 for(HUDPickupItem* item : items_) 71 73 { 72 sm_pair.second->hideMe(sm_pair.first, repaint);74 item->hideMe(); 73 75 } 74 76 75 picks.clear();76 assert( picks.empty()); //picksmust be empty now77 items_.clear(); 78 assert(items_.empty()); //items_ must be empty now 77 79 78 80 //add to local map and place on screen … … 95 97 item->initializeMaterial(this->getIcon(((Pickup*)pickup)->getRepresentationName()), offsetX+i*x, offsetY); 96 98 item->setOverlayGroup(this->getOverlayGroup()); 97 picks[pickup] = item;99 items_.push_back(item); 98 100 } 99 }100 101 102 void HUDPickupSystem::destroyAll()103 {104 this->background_->removeChild(overlayElement_->getName());105 101 } 106 102 -
code/trunk/src/modules/overlays/hud/HUDPickupSystem.h
r11700 r11702 33 33 #include "overlays/OverlaysPrereqs.h" 34 34 35 #include <map>36 35 #include <vector> 37 #include <string>38 36 39 40 #include <OgreOverlayManager.h> 41 #include <OgrePanelOverlayElement.h> 42 37 #include "util/OgreForwardRefs.h" 43 38 #include "overlays/OrxonoxOverlay.h" 44 #include "worldentities/pawns/Pawn.h"45 #include "overlays/OverlayGroup.h"46 #include "pickup/Pickup.h"47 #include "pickup/PickupRepresentation.h"48 #include "HUDPickupItem.h"49 39 50 40 namespace orxonox … … 59 49 void sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_); 60 50 61 bool repaint=true; //if we shouldnt repaint, set this to false62 63 51 private: 64 52 65 void destroyAll();66 53 std::string getIcon(std::string repName); 67 54 68 std::map<Pickupable*, HUDPickupItem*> picks; 69 55 std::vector<HUDPickupItem*> items_; 70 56 Ogre::PanelOverlayElement* overlayElement_; 71 WeakPtr<Pawn> owner_;72 73 std::vector<PickupRepresentation> pickupRepresentations_;74 57 }; 75 58 }
Note: See TracChangeset
for help on using the changeset viewer.